Adds Adding of Games to the system.

This commit is contained in:
2025-06-27 22:08:23 +02:00
parent 3f51d52edf
commit 28f7306d57
40 changed files with 792 additions and 130 deletions

View File

@@ -1,6 +1,6 @@
-- This file should undo anything in `up.sql`
drop table pwd;
drop table users;
drop table client;
drop type Role;

View File

@@ -1,6 +1,6 @@
CREATE TYPE Role AS ENUM ('user', 'admin');
CREATE TABLE users (
CREATE TABLE client (
id UUID NOT NULL PRIMARY KEY,
username VARCHAR UNIQUE NOT NULL,
email VARCHAR UNIQUE NOT NULL,
@@ -10,7 +10,7 @@ CREATE TABLE users (
CREATE TABLE pwd (
user_id UUID NOT NULL PRIMARY KEY,
password VARCHAR NOT NULL,
CONSTRAINT FK_UserId FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
CONSTRAINT FK_UserId FOREIGN KEY (user_id) REFERENCES client(id) ON DELETE CASCADE
);
--Initialize default admin user, with password "gamenight!"
@@ -19,7 +19,7 @@ DO $$
DECLARE
admin_uuid uuid = uuid_generate_v4();
BEGIN
INSERT INTO users (id, username, email, role)
INSERT INTO client (id, username, email, role)
values(admin_uuid, 'admin', '', 'admin');
insert INTO pwd (user_id, password)