groups WIP
This commit is contained in:
19
tables.sql
19
tables.sql
@ -5,17 +5,24 @@ CREATE TABLE picrinth.users (
|
||||
"role" text not null default "user",
|
||||
"disabled" bool not null,
|
||||
groups_ids integer[] NULL,
|
||||
last_seen_at timestamp with time zone NULL,
|
||||
created_at timestamp with time zone NULL,
|
||||
CONSTRAINT userid_pk PRIMARY KEY (id),
|
||||
last_seen_at timestamp with time zone null,
|
||||
created_at timestamp with time zone null,
|
||||
CONSTRAINT username_unique UNIQUE (username)
|
||||
);
|
||||
|
||||
CREATE TABLE picrinth.groups (
|
||||
id serial not null,
|
||||
groupname text not null,
|
||||
join_code text not null,
|
||||
users_ids integer[] null,
|
||||
invite_code text not null,
|
||||
created_at timestamp with time zone null,
|
||||
CONSTRAINT groupname_unique UNIQUE (username)
|
||||
CONSTRAINT groupname_unique UNIQUE (groupname)
|
||||
);
|
||||
|
||||
create table picrinth.group_members (
|
||||
username text,
|
||||
groupname text,
|
||||
joined_at timestamp with time zone null,
|
||||
PRIMARY KEY (username, groupname)
|
||||
FOREIGN KEY (username) REFERENCES users (username) on delete cascade on update cascade
|
||||
FOREIGN KEY (groupname) REFERENCES groups (groupname) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user