groups WIP

This commit is contained in:
2025-07-29 20:22:14 +03:00
parent 2ef27a9137
commit c203a890dc
9 changed files with 155 additions and 26 deletions

View File

@ -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
);