Skip to content

Commit

Permalink
update schema with new invite table
Browse files Browse the repository at this point in the history
  • Loading branch information
nebudev14 committed Aug 29, 2022
1 parent 8a58a59 commit 702411e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
11 changes: 10 additions & 1 deletion crates/db_models/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ table! {
}
}

table! {
invites (team_id, user_id) {
user_id -> Int4,
team_id -> Int4,
}
}

table! {
oauth_apps (client_id) {
client_id -> Text,
Expand Down Expand Up @@ -65,7 +72,6 @@ table! {
avatar -> Nullable<Text>,
personal -> Bool,
slug -> Text,
invite -> Text,
}
}

Expand Down Expand Up @@ -97,6 +103,8 @@ table! {
joinable!(apps -> teams (team_id));
joinable!(builds -> apps (app_id));
joinable!(domains -> apps (app_id));
joinable!(invites -> teams (team_id));
joinable!(invites -> users (user_id));
joinable!(oauth_device_requests -> oauth_apps (oauth_app_id));
joinable!(oauth_device_requests -> tokens (token));
joinable!(team_users -> teams (team_id));
Expand All @@ -107,6 +115,7 @@ allow_tables_to_appear_in_same_query!(
apps,
builds,
domains,
invites,
oauth_apps,
oauth_device_requests,
team_users,
Expand Down
1 change: 0 additions & 1 deletion crates/db_models/src/team.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub struct NewTeam {
#[serde(skip_deserializing)]
pub personal: bool,
pub slug: String,
pub invite: String,
}

#[derive(Clone, Debug, AsChangeset, Deserialize)]
Expand Down
3 changes: 0 additions & 3 deletions migrations/2022-08-25-052916_invite/up.sql

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-- This file should undo anything in `up.sql`
ALTER TABLE teams DROP COLUMN invite
DROP TABLE team_users
6 changes: 6 additions & 0 deletions migrations/2022-08-29-232653_invites/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Your SQL goes here
CREATE TABLE invites (
user_id INTEGER NOT NULL REFERENCES users (id),
team_id INTEGER NOT NULL REFERENCES teams (id),
PRIMARY KEY (team_id, user_id)
)

0 comments on commit 702411e

Please sign in to comment.