clean up team_memberships schema
This commit is contained in:
parent
37e91c36a8
commit
4a62d66400
4 changed files with 1 additions and 5 deletions
|
@ -18,7 +18,6 @@ CREATE TABLE teams (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE team_memberships (
|
CREATE TABLE team_memberships (
|
||||||
roles TEXT[] NOT NULL DEFAULT '{}',
|
|
||||||
team_id UUID NOT NULL REFERENCES teams(id) ON DELETE CASCADE,
|
team_id UUID NOT NULL REFERENCES teams(id) ON DELETE CASCADE,
|
||||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
PRIMARY KEY (team_id, user_id)
|
PRIMARY KEY (team_id, user_id)
|
||||||
|
@ -47,7 +46,7 @@ CREATE TABLE IF NOT EXISTS channels (
|
||||||
team_id UUID NOT NULL REFERENCES teams(id) ON DELETE CASCADE,
|
team_id UUID NOT NULL REFERENCES teams(id) ON DELETE CASCADE,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
enable_by_default BOOLEAN NOT NULL DEFAULT FALSE,
|
enable_by_default BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
backend_config JSONB NOT NULL DEFAULT '{}'::JSONB
|
backend_config JSONB NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS channel_selections (
|
CREATE TABLE IF NOT EXISTS channel_selections (
|
||||||
|
|
|
@ -214,7 +214,6 @@ async fn post_new_team(
|
||||||
let team_membership = TeamMembership {
|
let team_membership = TeamMembership {
|
||||||
team_id: team_id.clone(),
|
team_id: team_id.clone(),
|
||||||
user_id: current_user.id,
|
user_id: current_user.id,
|
||||||
roles: vec![Some("OWNER".to_string())],
|
|
||||||
};
|
};
|
||||||
db_conn
|
db_conn
|
||||||
.interact(move |conn| {
|
.interact(move |conn| {
|
||||||
|
|
|
@ -65,7 +65,6 @@ diesel::table! {
|
||||||
team_memberships (team_id, user_id) {
|
team_memberships (team_id, user_id) {
|
||||||
team_id -> Uuid,
|
team_id -> Uuid,
|
||||||
user_id -> Uuid,
|
user_id -> Uuid,
|
||||||
roles -> Array<Nullable<Text>>,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ use crate::{
|
||||||
pub struct TeamMembership {
|
pub struct TeamMembership {
|
||||||
pub team_id: Uuid,
|
pub team_id: Uuid,
|
||||||
pub user_id: Uuid,
|
pub user_id: Uuid,
|
||||||
pub roles: Vec<Option<String>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TeamMembership {
|
impl TeamMembership {
|
||||||
|
|
Loading…
Add table
Reference in a new issue