aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/database/categories.sql5
-rw-r--r--backend/database/chapters.sql17
-rw-r--r--backend/database/games.sql3
-rw-r--r--backend/database/init.sql98
-rw-r--r--backend/database/maps.sql228
5 files changed, 189 insertions, 162 deletions
diff --git a/backend/database/categories.sql b/backend/database/categories.sql
new file mode 100644
index 0000000..5cadad5
--- /dev/null
+++ b/backend/database/categories.sql
@@ -0,0 +1,5 @@
1INSERT INTO categories(id, name) VALUES
2(1, 'CM'),
3(2, 'No SLA'),
4(3, 'Inbounds SLA'),
5(4, 'Any%'); \ No newline at end of file
diff --git a/backend/database/chapters.sql b/backend/database/chapters.sql
new file mode 100644
index 0000000..f01ae9c
--- /dev/null
+++ b/backend/database/chapters.sql
@@ -0,0 +1,17 @@
1INSERT INTO chapters(id, game_id, name) VALUES
2(1, 1, 'The Coutesy Call'),
3(2, 1, 'The Cold Boot'),
4(3, 1, 'The Return'),
5(4, 1, 'The Surprise'),
6(5, 1, 'The Escape'),
7(6, 1, 'The Fall'),
8(7, 1, 'The Reunion'),
9(8, 1, 'The Itch'),
10(9, 1, 'The Part Where He Kills You'),
11(10, 2, 'Introduction'),
12(11, 2, 'Team Building'),
13(12, 2, 'Mass And Velocity'),
14(13, 2, 'Hard-Light Surfaces'),
15(14, 2, 'Excursion Funnels'),
16(15, 2, 'Mobility Gels'),
17(16, 2, 'Art Therapy'); \ No newline at end of file
diff --git a/backend/database/games.sql b/backend/database/games.sql
new file mode 100644
index 0000000..5e2f4ee
--- /dev/null
+++ b/backend/database/games.sql
@@ -0,0 +1,3 @@
1INSERT INTO games(id, name) VALUES
2(1, 'Portal 2 - Singleplayer'),
3(2, 'Portal 2 - Cooperative'); \ No newline at end of file
diff --git a/backend/database/init.sql b/backend/database/init.sql
index 7e225f0..a82404a 100644
--- a/backend/database/init.sql
+++ b/backend/database/init.sql
@@ -1,13 +1,3 @@
1DROP TABLE IF EXISTS showcases;
2DROP TABLE IF EXISTS titles;
3DROP TABLE IF EXISTS records_sp;
4DROP TABLE IF EXISTS records_mp;
5DROP TABLE IF EXISTS maps;
6DROP TABLE IF EXISTS users;
7DROP TABLE IF EXISTS countries;
8
9DROP TABLE IF EXISTS demos;
10
11CREATE TABLE users ( 1CREATE TABLE users (
12 steam_id TEXT, 2 steam_id TEXT,
13 username TEXT NOT NULL, 3 username TEXT NOT NULL,
@@ -18,14 +8,59 @@ CREATE TABLE users (
18 PRIMARY KEY (steam_id) 8 PRIMARY KEY (steam_id)
19); 9);
20 10
11CREATE TABLE games (
12 id SMALLSERIAL,
13 name TEXT NOT NULL,
14 PRIMARY KEY (id)
15);
16
17CREATE TABLE chapters (
18 id SMALLSERIAL,
19 game_id SMALLINT NOT NULL,
20 name TEXT NOT NULL,
21 PRIMARY KEY (id),
22 FOREIGN KEY (game_id) REFERENCES games(id)
23);
24
25CREATE TABLE categories (
26 id SMALLSERIAL,
27 name TEXT NOT NULL,
28 PRIMARY KEY (id)
29);
30
21CREATE TABLE maps ( 31CREATE TABLE maps (
22 id SMALLSERIAL, 32 id SMALLSERIAL,
23 map_name TEXT NOT NULL, 33 game_id SMALLINT NOT NULL,
24 wr_score SMALLINT NOT NULL, 34 chapter_id SMALLINT NOT NULL,
25 wr_time INTEGER NOT NULL, 35 name TEXT NOT NULL,
26 is_coop BOOLEAN NOT NULL, 36 description TEXT NOT NULL,
37 showcase TEXT NOT NULL,
27 is_disabled BOOLEAN NOT NULL DEFAULT false, 38 is_disabled BOOLEAN NOT NULL DEFAULT false,
28 PRIMARY KEY (id) 39 PRIMARY KEY (id),
40 FOREIGN KEY (game_id) REFERENCES games(id),
41 FOREIGN KEY (chapter_id) REFERENCES chapters(id)
42);
43
44CREATE TABLE map_history (
45 id SMALLSERIAL,
46 map_id SMALLINT NOT NULL,
47 user_id TEXT,
48 user_name TEXT NOT NULL,
49 score_count SMALLINT NOT NULL,
50 record_date TIMESTAMP NOT NULL,
51 PRIMARY KEY (id),
52 FOREIGN KEY (map_id) REFERENCES maps(id),
53 FOREIGN KEY (user_id) REFERENCES users(steam_id)
54);
55
56CREATE TABLE map_rating (
57 id SERIAL,
58 map_id SMALLINT NOT NULL,
59 user_id TEXT NOT NULL,
60 rating SMALLINT NOT NULL,
61 PRIMARY KEY (id),
62 FOREIGN KEY (map_id) REFERENCES maps(id),
63 FOREIGN KEY (user_id) REFERENCES users(steam_id)
29); 64);
30 65
31CREATE TABLE demos ( 66CREATE TABLE demos (
@@ -78,36 +113,3 @@ CREATE TABLE countries (
78 country_name TEXT NOT NULL, 113 country_name TEXT NOT NULL,
79 PRIMARY KEY (country_code) 114 PRIMARY KEY (country_code)
80); 115);
81
82-- CREATE TABLE community_maps (
83-- id SMALLSERIAL,
84-- map_id SMALLINT NOT NULL,
85-- category TEXT NOT NULL,
86-- tutorial TEXT NOT NULL,
87-- video_link TEXT NOT NULL,
88-- PRIMARY KEY (id),
89-- FOREIGN KEY (map_id) REFERENCES maps(id)
90-- );
91
92-- TODO
93-- CREATE TABLE community_history (
94-- id SERIAL,
95-- map_id SMALLINT NOT NULL,
96-- user_id TEXT NOT NULL,
97-- score_count SMALLINT NOT NULL,
98-- created_at TIMESTAMP NOT NULL DEFAULT now(),
99-- PRIMARY KEY (id),
100-- FOREIGN KEY (user_id) REFERENCES users(steam_id),
101-- FOREIGN KEY (map_id) REFERENCES maps(id)
102-- );
103
104-- CREATE TABLE community_posts (
105-- id SERIAL,
106-- map_id SMALLINT NOT NULL,
107-- user_id TEXT NOT NULL,
108-- post TEXT NOT NULL,
109-- created_at TIMESTAMP NOT NULL DEFAULT now(),
110-- PRIMARY KEY (id),
111-- FOREIGN KEY (user_id) REFERENCES users(steam_id),
112-- FOREIGN KEY (map_id) REFERENCES maps(id)
113-- ); \ No newline at end of file
diff --git a/backend/database/maps.sql b/backend/database/maps.sql
index 127eb58..50689e2 100644
--- a/backend/database/maps.sql
+++ b/backend/database/maps.sql
@@ -1,129 +1,129 @@
1DELETE FROM maps; 1INSERT INTO maps(game_id, chapter_id, name, description, showcase, is_disabled) VALUES
2INSERT INTO maps (map_name, wr_score, wr_time, is_coop, is_disabled) VALUES 2-- Portal 2 Singleplayer
3-- Singleplayer
4-- 1 3-- 1
5('Container Ride',0,-1,false,true), 4(1,1,'Container Ride','','',true),
6('Portal Carousel',0,-1,false,true), 5(1,1,'Portal Carousel','','',true),
7('Portal Gun',0,-1,false,false), 6(1,1,'Portal Gun','','',false),
8('Smooth Jazz',0,-1,false,false), 7(1,1,'Smooth Jazz','','',false),
9('Cube Momentum',1,-1,false,false), 8(1,1,'Cube Momentum','','',false),
10('Future Starter',2,-1,false,false), 9(1,1,'Future Starter','','',false),
11('Secret Panel',0,-1,false,false), 10(1,1,'Secret Panel','','',false),
12('Wakeup',0,-1,false,true), 11(1,1,'Wakeup','','',true),
13('Incinerator',0,-1,false,false), 12(1,1,'Incinerator','','',false),
14-- 2 13-- 2
15('Laser Intro',0,-1,false,false), 14(1,2,'Laser Intro','','',false),
16('Laser Stairs',0,-1,false,false), 15(1,2,'Laser Stairs','','',false),
17('Dual Lasers',2,-1,false,false), 16(1,2,'Dual Lasers','','',false),
18('Laser Over Goo',0,-1,false,false), 17(1,2,'Laser Over Goo','','',false),
19('Catapult Intro',0,-1,false,true), 18(1,2,'Catapult Intro','','',true),
20('Trust Fling',2,-1,false,false), 19(1,2,'Trust Fling','','',false),
21('Pit Flings',0,-1,false,false), 20(1,2,'Pit Flings','','',false),
22('Fizzler Intro',2,-1,false,false), 21(1,2,'Fizzler Intro','','',false),
23-- 3 22-- 3
24('Ceiling Catapult',0,-1,false,false), 23(1,3,'Ceiling Catapult','','',false),
25('Ricochet',2,-1,false,false), 24(1,3,'Ricochet','','',false),
26('Bridge Intro',2,-1,false,false), 25(1,3,'Bridge Intro','','',false),
27('Bridge The Gap',0,-1,false,false), 26(1,3,'Bridge The Gap','','',false),
28('Turret Intro',0,-1,false,false), 27(1,3,'Turret Intro','','',false),
29('Laser Relays',0,-1,false,false), 28(1,3,'Laser Relays','','',false),
30('Turret Blocker',0,-1,false,false), 29(1,3,'Turret Blocker','','',false),
31('Laser vs Turret',0,-1,false,false), 30(1,3,'Laser vs Turret','','',false),
32('Pull The Rug',0,-1,false,false), 31(1,3,'Pull The Rug','','',false),
33-- 4 32-- 4
34('Column Blocker',0,-1,false,false), 33(1,4,'Column Blocker','','',false),
35('Laser Chaining',0,-1,false,false), 34(1,4,'Laser Chaining','','',false),
36('Triple Laser',0,-1,false,false), 35(1,4,'Triple Laser','','',false),
37('Jail Break',2,-1,false,false), 36(1,4,'Jail Break','','',false),
38('Escape',0,-1,false,false), 37(1,4,'Escape','','',false),
39-- 5 38-- 5
40('Turret Factory',5,-1,false,false), 39(1,5,'Turret Factory','','',false),
41('Turret Sabotage',4,-1,false,false), 40(1,5,'Turret Sabotage','','',false),
42('Neurotoxin Sabotage',0,-1,false,false), 41(1,5,'Neurotoxin Sabotage','','',false),
43('Core',2,-1,false,false), 42(1,5,'Core','','',false),
44-- 6 43-- 6
45('Underground',4,-1,false,false), 44(1,6,'Underground','','',false),
46('Cave Johnson',4,-1,false,false), 45(1,6,'Cave Johnson','','',false),
47('Repulsion Intro',0,-1,false,false), 46(1,6,'Repulsion Intro','','',false),
48('Bomb Flings',3,-1,false,false), 47(1,6,'Bomb Flings','','',false),
49('Crazy Box',0,-1,false,false), 48(1,6,'Crazy Box','','',false),
50('PotatOS',5,-1,false,false), 49(1,6,'PotatOS','','',false),
51-- 7 50-- 7
52('Propulsion Intro',2,-1,false,false), 51(1,7,'Propulsion Intro','','',false),
53('Propulsion Flings',0,-1,false,false), 52(1,7,'Propulsion Flings','','',false),
54('Conversion Intro',9,-1,false,false), 53(1,7,'Conversion Intro','','',false),
55('Three Gels',4,-1,false,false), 54(1,7,'Three Gels','','',false),
56-- 8 55-- 8
57('Test',2,-1,false,false), 56(1,8,'Test','','',false),
58('Funnel Intro',0,-1,false,false), 57(1,8,'Funnel Intro','','',false),
59('Ceiling Button',0,-1,false,false), 58(1,8,'Ceiling Button','','',false),
60('Wall Button',0,-1,false,false), 59(1,8,'Wall Button','','',false),
61('Polarity',0,-1,false,false), 60(1,8,'Polarity','','',false),
62('Funnel Catch',2,-1,false,false), 61(1,8,'Funnel Catch','','',false),
63('Stop The Box',0,-1,false,false), 62(1,8,'Stop The Box','','',false),
64('Laser Catapult',0,-1,false,false), 63(1,8,'Laser Catapult','','',false),
65('Laser Platform',3,-1,false,false), 64(1,8,'Laser Platform','','',false),
66('Propulsion Catch',0,-1,false,false), 65(1,8,'Propulsion Catch','','',false),
67('Repulsion Polarity',2,-1,false,false), 66(1,8,'Repulsion Polarity','','',false),
68-- 9 67-- 9
69('Finale 1',0,-1,false,false), 68(1,9,'Finale 1','','',false),
70('Finale 2',2,-1,false,false), 69(1,9,'Finale 2','','',false),
71('Finale 3',6,-1,false,false), 70(1,9,'Finale 3','','',false),
72('Finale 4',6,-1,false,false), 71(1,9,'Finale 4','','',false),
73-- Coop 72-- Portal 2 Cooperative
73-- 0
74(2,10,'Calibration','','',false),
75(2,10,'Hub','','',true),
74-- 1 76-- 1
75('Calibration',4,-1,true,false), 77(2,11,'Doors','','',false),
76('Hub',0,-1,false,true), 78(2,11,'Buttons','','',false),
77('Doors',0,-1,true,false), 79(2,11,'Lasers','','',false),
78('Buttons',2,-1,true,false), 80(2,11,'Rat Maze','','',false),
79('Lasers',3,-1,true,false), 81(2,11,'Laser Crusher','','',false),
80('Rat Maze',2,-1,true,false), 82(2,11,'Behind The Scenes','','',false),
81('Laser Crusher',0,-1,true,false),
82('Behind The Scenes',0,-1,true,false),
83-- 2 83-- 2
84('Flings',4,-1,true,false), 84(2,12,'Flings','','',false),
85('Infinifling',0,-1,true,false), 85(2,12,'Infinifling','','',false),
86('Team Retrieval',0,-1,true,false), 86(2,12,'Team Retrieval','','',false),
87('Vertical Flings',2,-1,true,false), 87(2,12,'Vertical Flings','','',false),
88('Catapults',4,-1,true,false), 88(2,12,'Catapults','','',false),
89('Multifling',2,-1,true,false), 89(2,12,'Multifling','','',false),
90('Fling Crushers',0,-1,true,false), 90(2,12,'Fling Crushers','','',false),
91('Industrial Fan',0,-1,true,false), 91(2,12,'Industrial Fan','','',false),
92-- 3 92-- 3
93('Cooperative Bridges',3,-1,true,false), 93(2,13,'Cooperative Bridges','','',false),
94('Bridge Swap',2,-1,true,false), 94(2,13,'Bridge Swap','','',false),
95('Fling Block',2,-1,true,false), 95(2,13,'Fling Block','','',false),
96('Catapult Block',4,-1,true,false), 96(2,13,'Catapult Block','','',false),
97('Bridge Fling',4,-1,true,false), 97(2,13,'Bridge Fling','','',false),
98('Turret Walls',4,-1,true,false), 98(2,13,'Turret Walls','','',false),
99('Turret Assasin',0,-1,true,false), 99(2,13,'Turret Assasin','','',false),
100('Bridge Testing',0,-1,true,false), 100(2,13,'Bridge Testing','','',false),
101-- 4 101-- 4
102('Cooperative Funnels',0,-1,true,false), 102(2,14,'Cooperative Funnels','','',false),
103('Funnel Drill',0,-1,true,false), 103(2,14,'Funnel Drill','','',false),
104('Funnel Catch',0,-1,true,false), 104(2,14,'Funnel Catch','','',false),
105('Funnel Laser',0,-1,true,false), 105(2,14,'Funnel Laser','','',false),
106('Cooperative Polarity',0,-1,true,false), 106(2,14,'Cooperative Polarity','','',false),
107('Funnel Hop',0,-1,true,false), 107(2,14,'Funnel Hop','','',false),
108('Advanced Polarity',0,-1,true,false), 108(2,14,'Advanced Polarity','','',false),
109('Funnel Maze',0,-1,true,false), 109(2,14,'Funnel Maze','','',false),
110('Turret Warehouse',0,-1,true,false), 110(2,14,'Turret Warehouse','','',false),
111-- 5 111-- 5
112('Repulsion Jumps',0,-1,true,false), 112(2,15,'Repulsion Jumps','','',false),
113('Double Bounce',2,-1,true,false), 113(2,15,'Double Bounce','','',false),
114('Bridge Repulsion',2,-1,true,false), 114(2,15,'Bridge Repulsion','','',false),
115('Wall Repulsion',2,-1,true,false), 115(2,15,'Wall Repulsion','','',false),
116('Propulsion Crushers',0,-1,true,false), 116(2,15,'Propulsion Crushers','','',false),
117('Turret Ninja',0,-1,true,false), 117(2,15,'Turret Ninja','','',false),
118('Propulsion Retrieval',0,-1,true,false), 118(2,15,'Propulsion Retrieval','','',false),
119('Vault Entrance',0,-1,true,false), 119(2,15,'Vault Entrance','','',false),
120-- 6 120-- 6
121('Seperation',0,-1,true,false), 121(2,16,'Seperation','','',false),
122('Triple Axis',0,-1,true,false), 122(2,16,'Triple Axis','','',false),
123('Catapult Catch',0,-1,true,false), 123(2,16,'Catapult Catch','','',false),
124('Bridge Gels',2,-1,true,false), 124(2,16,'Bridge Gels','','',false),
125('Maintenance',0,-1,true,false), 125(2,16,'Maintenance','','',false),
126('Bridge Catch',0,-1,true,false), 126(2,16,'Bridge Catch','','',false),
127('Double Lift',0,-1,true,false), 127(2,16,'Double Lift','','',false),
128('Gel Maze',0,-1,true,false), 128(2,16,'Gel Maze','','',false),
129('Crazier Box',0,-1,true,false); \ No newline at end of file 129(2,16,'Crazier Box','','',false); \ No newline at end of file