more robust sql scripts
This commit is contained in:
parent
f363df0e74
commit
941f924608
22
defaults.sql
Normal file
22
defaults.sql
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
INSERT INTO difficulty VALUES('easy');
|
||||||
|
INSERT INTO difficulty VALUES('medium');
|
||||||
|
INSERT INTO difficulty VALUES('hard');
|
||||||
|
INSERT INTO difficulty VALUES('fuck you');
|
||||||
|
|
||||||
|
INSERT INTO tag VALUES('math');
|
||||||
|
INSERT INTO tag VALUES('AI');
|
||||||
|
INSERT INTO tag VALUES('networking');
|
||||||
|
INSERT INTO tag VALUES('games');
|
||||||
|
INSERT INTO tag VALUES('rendering');
|
||||||
|
INSERT INTO tag VALUES('simulation');
|
||||||
|
|
||||||
|
--
|
||||||
|
INSERT INTO project (title, body) VALUES (
|
||||||
|
'test project',
|
||||||
|
'desc'
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO assignment VALUES (
|
||||||
|
'#/g/chad',
|
||||||
|
1
|
||||||
|
);
|
23
init.sql
23
init.sql
@ -1,3 +1,4 @@
|
|||||||
|
DROP TABLE IF EXISTS project;
|
||||||
CREATE TABLE project (
|
CREATE TABLE project (
|
||||||
title VARCHAR(64) NOT NULL,
|
title VARCHAR(64) NOT NULL,
|
||||||
body TEXT DEFAULT NULL,
|
body TEXT DEFAULT NULL,
|
||||||
@ -8,29 +9,25 @@ CREATE TABLE project (
|
|||||||
span INT NOT NULL DEFAULT 7 -- time to last for in days
|
span INT NOT NULL DEFAULT 7 -- time to last for in days
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS difficulty;
|
||||||
CREATE TABLE difficulty (
|
CREATE TABLE difficulty (
|
||||||
diff VARCHAR(16)
|
diff VARCHAR(16)
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO difficulty VALUES('easy');
|
|
||||||
INSERT INTO difficulty VALUES('medium');
|
|
||||||
INSERT INTO difficulty VALUES('hard');
|
|
||||||
INSERT INTO difficulty VALUES('fuck you');
|
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS tag;
|
||||||
CREATE TABLE tag (
|
CREATE TABLE tag (
|
||||||
t VARCHAR(16)
|
t VARCHAR(16)
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Some default (not all) tags
|
DROP TABLE IF EXISTS project_tag;
|
||||||
INSERT INTO tag VALUES('math');
|
|
||||||
INSERT INTO tag VALUES('AI');
|
|
||||||
INSERT INTO tag VALUES('networking');
|
|
||||||
INSERT INTO tag VALUES('games');
|
|
||||||
INSERT INTO tag VALUES('rendering');
|
|
||||||
INSERT INTO tag VALUES('simulation');
|
|
||||||
|
|
||||||
CREATE TABLE project_tag (
|
CREATE TABLE project_tag (
|
||||||
project INT REFERENCES project(rowid),
|
project INT REFERENCES project(rowid),
|
||||||
tag INT REFERENCES tag(rowid)
|
tag INT REFERENCES tag(rowid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS assignment;
|
||||||
|
CREATE TABLE assignment (
|
||||||
|
who VARCHAR(32) NOT NULL,
|
||||||
|
project INT NOT NULL REFERENCES project(rowid)
|
||||||
|
);
|
||||||
|
Reference in New Issue
Block a user