Backend: Move Sql from dev to Backend.DataAccess/Sql
This commit is contained in:
parent
2b3ec0d718
commit
d5b3128f13
1
web/Backend.DataAccess/Sql/coresim/insert.psql
Normal file
1
web/Backend.DataAccess/Sql/coresim/insert.psql
Normal file
@ -0,0 +1 @@
|
||||
INSERT INTO public.PERSON (person_firstname, person_lastname, person_age, alive, nation_id) VALUES ('lohojequ', 'Vanrokick', 55, true, 1);
|
||||
26
web/Backend.DataAccess/Sql/coresim/schema.psql
Normal file
26
web/Backend.DataAccess/Sql/coresim/schema.psql
Normal file
@ -0,0 +1,26 @@
|
||||
-- Add UUID extension
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.NATION (
|
||||
nation_id SERIAL UNIQUE,
|
||||
nation_name VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (nation_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.PERSON (
|
||||
person_id uuid UNIQUE NOT NULL DEFAULT uuid_generate_v4(),
|
||||
person_firstname VARCHAR(36),
|
||||
person_lastname VARCHAR(36),
|
||||
person_age INTEGER DEFAULT 0 CHECK (person_age >= 0),
|
||||
alive BOOLEAN NOT NULL DEFAULT true,
|
||||
nation_id INTEGER REFERENCES public.NATION(nation_id) ON UPDATE CASCADE,
|
||||
PRIMARY KEY (person_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.WORKORDER (
|
||||
wo_id uuid UNIQUE NOT NULL DEFAULT uuid_generate_v4(),
|
||||
wo_description TEXT,
|
||||
wo_complete BOOLEAN NOT NULL DEFAULT false,
|
||||
person_id uuid NOT NULL REFERENCES public.PERSON(person_id) ON UPDATE CASCADE,
|
||||
PRIMARY KEY (wo_id)
|
||||
);
|
||||
28
web/Backend.DataAccess/Sql/items/schema.sql
Normal file
28
web/Backend.DataAccess/Sql/items/schema.sql
Normal file
@ -0,0 +1,28 @@
|
||||
-- User Access And Permissions
|
||||
|
||||
-- Tables
|
||||
CREATE TABLE IF NOT EXISTS public.user (
|
||||
id INTEGER PRIMARY KEY,
|
||||
created_date DATETIME NOT NULL DEFAULT NOW(),
|
||||
updated_date DATETIME NOT NULL DEFAULT NOW(),
|
||||
last_login DATETIME,
|
||||
username VARCHAR(255) NOT NULL,
|
||||
email_id INT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.email (
|
||||
id TEXT PRIMARY KEY,
|
||||
created_date DATETIME NOT NULL DEFAULT NOW(),
|
||||
updated_date DATETIME NOT NULL DEFAULT NOW(),
|
||||
user_id INT FOREIGN KEY
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.items (
|
||||
id INTEGER PRIMARY KEY,
|
||||
created_date DATETIME NOT NULL DEFAULT NOW(),
|
||||
updated_date DATETIME NOT NULL DEFAULT NOW(),
|
||||
user_id INT FOREIGN KEY
|
||||
img_url TEXT,
|
||||
flavor_text TEXT,
|
||||
stats JSON DEFAULT '{}'
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user