Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql #100

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 261 additions & 22 deletions Cargo.lock

Large diffs are not rendered by default.

36 changes: 24 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,50 @@ authors = ["Joe Jackson <[email protected]>"]
edition = "2018"

[dependencies]
# Serialization
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
serde_yaml = "0.8"
regex = "1"
lazy_static = "1.4"
base64 = "0.12"
rand = "0.7"

# Web Framework
actix-session = "0.4"
actix-files = "0.5"
actix-web-flash = { version = "0.5.0", git = "https://github.com/joeyjoejoejr/actix-web-flash" }
actix-web = "3"
actix-rt = "1.0"
actix-service = "1.0"
askama = "0.9"

# GraphQl
juniper = "0.15"
juniper_actix = "0.2"

# Database
diesel = { version = "1.4", features = ["postgres", "r2d2", "chrono"] }
r2d2 = "0.8"
chrono = "0.4"

# Testing
mockito = "0.14.0"
url = "2.1"
hyperx = "1.0"

# Util
regex = "1"
lazy_static = "1.4"
base64 = "0.12"
rand = "0.7"
log = "0.4"
env_logger = "0.7"
futures = "0.3"
failure = "0.1"
failure_derive = "0.1"
askama = "0.9"

reqwest = { version = "0.10", features = ["json"] }
mockito = "0.14.0"
url = "2.1"
hyperx = "1.0"

# Development
structopt = "0.3"
listenfd = "0.3"
dotenv = "0.15"

diesel = { version = "1.4", features = ["postgres", "r2d2", "chrono"] }
r2d2 = "0.8"
chrono = "0.4"

10 changes: 10 additions & 0 deletions migrations/2021-02-26-221355_add_foreign_keys/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- This file should undo anything in `up.sql`
/* ALTER TABLE pull_requests */
/* DROP CONSTRAINT fk_pullrequestsgithubuser; */

ALTER TABLE reviews
DROP CONSTRAINT fk_pullrequestreviews;

ALTER TABLE reviews
DROP CONSTRAINT fk_githubusersreviews;

16 changes: 16 additions & 0 deletions migrations/2021-02-26-221355_add_foreign_keys/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Your SQL goes here
/* ALTER TABLE pull_requests */
/* ADD CONSTRAINT fk_pullrequestsgithubusers */
/* FOREIGN KEY (github_user_id) */
/* REFERENCES github_users(id); */

ALTER TABLE reviews
ADD CONSTRAINT fk_pullrequestreviews
FOREIGN KEY (pull_request_id)
REFERENCES pull_requests(id);

ALTER TABLE reviews
ADD CONSTRAINT fk_githubusersreviews
FOREIGN KEY (github_user_id)
REFERENCES github_users(id);

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- This file should undo anything in `up.sql`
ALTER TABLE pull_requests
DROP CONSTRAINT fk_pullrequestsgithubusers;

UPDATE pull_requests
SET github_user_id = (
SELECT github_id
FROM github_users
WHERE github_users.id = pull_requests.github_user_id
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Your SQL goes here
UPDATE pull_requests
SET github_user_id = (
SELECT id
FROM github_users
WHERE github_users.github_id = pull_requests.github_user_id
);

ALTER TABLE pull_requests
ADD CONSTRAINT fk_pullrequestsgithubusers
FOREIGN KEY (github_user_id)
REFERENCES github_users(id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This file should undo anything in `up.sql`
ALTER TABLE github_users
DROP CONSTRAINT fk_githubuserusers;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Your SQL goes here
ALTER TABLE github_users
ADD CONSTRAINT fk_githubuserusers
FOREIGN KEY (user_id)
REFERENCES users(id);
1 change: 1 addition & 0 deletions src/graphql/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod schema;
Loading