From ac889169c777be38598680c7f468114cd9fb09fc Mon Sep 17 00:00:00 2001
From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>
Date: Mon, 24 Apr 2023 18:04:39 +0300
Subject: feat: map summary and leaderboard endpoints, new models and routes
 (#38)

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

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

diff --git a/backend/database/init.sql b/backend/database/init.sql
index a82404a..53c9262 100644
--- a/backend/database/init.sql
+++ b/backend/database/init.sql
@@ -53,7 +53,7 @@ CREATE TABLE map_history (
   FOREIGN KEY (user_id) REFERENCES users(steam_id)
 );
 
-CREATE TABLE map_rating (
+CREATE TABLE map_ratings (
   id SERIAL,
   map_id SMALLINT NOT NULL,
   user_id TEXT NOT NULL,
@@ -63,6 +63,17 @@ CREATE TABLE map_rating (
   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

