wrbapp-next/server/migrations/001-create-user-member-session.sql

29 lines
609 B
MySQL
Raw Permalink Normal View History

2025-01-15 23:20:17 +01:00
CREATE TABLE user (
id bigint NOT NULL PRIMARY KEY,
email text NOT NULL UNIQUE,
password text NOT NULL,
admin boolean NOT NULL
);
CREATE TABLE member (
id varchar(7) NOT NULL PRIMARY KEY,
call_sign text NOT NULL,
name text NOT NULL,
registration_token text NOT NULL UNIQUE,
diploma text,
hours text[] NOT NULL,
groups text[] NOT NULL
);
CREATE TABLE session (
id bigint NOT NULL PRIMARY KEY,
user_id bigint NOT NULL,
token text NOT NULL UNIQUE,
expires timestamp NOT NULL
);
ALTER TABLE session ADD CONSTRAINT session_user_id_fk FOREIGN KEY (user_id) REFERENCES user (id);