Updated schemas

This commit is contained in:
2025-01-31 16:11:56 +01:00
parent 55395d279e
commit 6322736baf
4 changed files with 27 additions and 14 deletions

View File

@@ -1,10 +1,10 @@
create table "members" (
id varchar(7) primary key,
first_name text not null,
full_name text not null,
registration_token text unique not null,
CREATE TABLE "members" (
member_id varchar(7) NOT NULL PRIMARY KEY,
first_name text NOT NULL,
full_name text NOT NULL,
registration_token text NOT NULL UNIQUE,
diploma text,
hours text[] not null,
groups text[] not null
hours text[] NOT NULL,
groups text[] NOT NULL
);

View File

@@ -0,0 +1,13 @@
CREATE TABLE "users" (
user_id uuid NOT NULL PRIMARY KEY,
email text UNIQUE,
password text NOT NULL,
admin boolean NOT NULL
);
CREATE TABLE IF NOT EXISTS users_members (
user_id uuid NOT NULL REFERENCES users (user_id) ON UPDATE cascade ON DELETE cascade,
member_id varchar(7) NOT NULL REFERENCES members (member_id) ON UPDATE cascade ON DELETE cascade,
CONSTRAINT users_members_pkey PRIMARY KEY (user_id, member_id)
);