2023-12-23 21:27:52 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS "role" (
|
|
|
|
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
|
|
"name" text NOT NULL UNIQUE
|
|
|
|
);
|
|
|
|
INSERT INTO "role" (name) VALUES ('admin');
|
|
|
|
INSERT INTO "role" (name) VALUES ('cox');
|
|
|
|
INSERT INTO "role" (name) VALUES ('scheckbuch');
|
|
|
|
INSERT INTO "role" (name) VALUES ('tech');
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS "user_role" (
|
|
|
|
"user_id" INTEGER NOT NULL REFERENCES user(id),
|
|
|
|
"role_id" INTEGER NOT NULL REFERENCES role(id),
|
|
|
|
CONSTRAINT unq UNIQUE (user_id, role_id)
|
|
|
|
);
|