From 5fec69af648e7c5c8a682132c9996f2883d1a99e Mon Sep 17 00:00:00 2001
From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>
Date: Sat, 17 Jun 2023 23:58:23 +0300
Subject: feat: map routes table (#1)

---
 backend/database/init.sql | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

(limited to 'backend/database/init.sql')

diff --git a/backend/database/init.sql b/backend/database/init.sql
index 51a4881..871aba2 100644
--- a/backend/database/init.sql
+++ b/backend/database/init.sql
@@ -33,14 +33,24 @@ CREATE TABLE maps (
   game_id SMALLINT NOT NULL,
   chapter_id SMALLINT NOT NULL,
   name TEXT NOT NULL,
-  description TEXT NOT NULL,
-  showcase TEXT NOT NULL,
   is_disabled BOOLEAN NOT NULL DEFAULT false,
   PRIMARY KEY (id),
   FOREIGN KEY (game_id) REFERENCES games(id),
   FOREIGN KEY (chapter_id) REFERENCES chapters(id)
 );
 
+CREATE TABLE map_routes (
+  id SMALLSERIAL,
+  map_id SMALLINT NOT NULL,
+  category_id SMALLINT NOT NULL,
+  score_count SMALLINT NOT NULL,
+  description TEXT NOT NULL,
+  showcase TEXT NOT NULL,
+  PRIMARY KEY (id),
+  FOREIGN KEY (map_id) REFERENCES maps(id),
+  FOREIGN KEY (category_id) REFERENCES categories(id)
+);
+
 CREATE TABLE map_history (
   id SMALLSERIAL,
   map_id SMALLINT NOT NULL,
@@ -61,17 +71,6 @@ CREATE TABLE map_ratings (
   FOREIGN KEY (user_id) REFERENCES users(steam_id)
 );
 
-CREATE TABLE map_routers (
-  id SMALLSERIAL,
-  map_id SMALLINT NOT NULL,
-  user_id TEXT,
-  user_name TEXT NOT NULL,
-  score_count SMALLINT NOT NULL,
-  PRIMARY KEY (id),
-  FOREIGN KEY (map_id) REFERENCES maps(id),
-  FOREIGN KEY (user_id) REFERENCES users(steam_id)
-);
-
 CREATE TABLE demos (
   id UUID,
   location_id TEXT NOT NULL,
-- 
cgit v1.2.3

