forked from Roflin/gamenight
Adds Adding of Games to the system.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
|
||||
drop table pwd;
|
||||
drop table users;
|
||||
drop table client;
|
||||
|
||||
drop type Role;
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user