Creation of database foundations.

This commit is contained in:
Florian THIERRY
2023-11-30 17:09:00 +01:00
parent a8046a1227
commit cb07b71a88
4 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1 @@
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

View File

@@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS "user" (
id UUID NOT NULL,
password VARCHAR NOT NULL,
CONSTRAINT user_pk PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS user_role (
user_id UUID NOT NULL,
role SMALLINT,
CONSTRAINT user_role_pk PRIMARY KEY (user_id, role),
CONSTRAINT user_role_fk_user_id FOREIGN KEY (user_id) REFERENCES "user" (id)
);
CREATE INDEX user_role_fk_user_id_idx ON user_role (user_id);