diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-12 09:56:11 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-12 09:56:11 +0300 |
| commit | cae45e130891cf97f93d743ace381eb8209df2a8 (patch) | |
| tree | 72498d3b34da119eac40804282f896655e41b3b4 /backend | |
| parent | feat: is_coop field on map summary (diff) | |
| download | lphub-cae45e130891cf97f93d743ace381eb8209df2a8.tar.gz lphub-cae45e130891cf97f93d743ace381eb8209df2a8.tar.bz2 lphub-cae45e130891cf97f93d743ace381eb8209df2a8.zip | |
fix: unique relation for map history and routes
Former-commit-id: f3ea2ce6784973385d63980b6680294bbcee0188
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/database/history.sql | 2 | ||||
| -rw-r--r-- | backend/database/init.sql | 6 | ||||
| -rw-r--r-- | backend/database/route.sql | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/backend/database/history.sql b/backend/database/history.sql index d7c4999..320d72f 100644 --- a/backend/database/history.sql +++ b/backend/database/history.sql | |||
| @@ -27,7 +27,7 @@ INSERT INTO map_history(map_id,category_id,user_name,score_count,record_date) VA | |||
| 27 | (15,1,'Tyronis',2,'2011-10-05 00:00:00'), | 27 | (15,1,'Tyronis',2,'2011-10-05 00:00:00'), |
| 28 | (16,1,'LookLikeAKango',2,'2011-10-05 00:00:00'), | 28 | (16,1,'LookLikeAKango',2,'2011-10-05 00:00:00'), |
| 29 | (16,1,'jyjey',0,'2012-08-25 00:00:00'), | 29 | (16,1,'jyjey',0,'2012-08-25 00:00:00'), |
| 30 | (17,1,'rocoty',0,'2011-10-05 00:00:00'), | 30 | (17,1,'rocoty',2,'2011-10-05 00:00:00'), |
| 31 | (17,1,'Nidboj132',0,'2023-02-05 00:00:00'), | 31 | (17,1,'Nidboj132',0,'2023-02-05 00:00:00'), |
| 32 | -- 3 | 32 | -- 3 |
| 33 | (18,1,'The Last Tofus',5,'2011-05-08 00:00:00'), | 33 | (18,1,'The Last Tofus',5,'2011-05-08 00:00:00'), |
diff --git a/backend/database/init.sql b/backend/database/init.sql index c7d098c..196cb71 100644 --- a/backend/database/init.sql +++ b/backend/database/init.sql | |||
| @@ -49,7 +49,8 @@ CREATE TABLE map_routes ( | |||
| 49 | showcase TEXT NOT NULL, | 49 | showcase TEXT NOT NULL, |
| 50 | PRIMARY KEY (id), | 50 | PRIMARY KEY (id), |
| 51 | FOREIGN KEY (map_id) REFERENCES maps(id), | 51 | FOREIGN KEY (map_id) REFERENCES maps(id), |
| 52 | FOREIGN KEY (category_id) REFERENCES categories(id) | 52 | FOREIGN KEY (category_id) REFERENCES categories(id), |
| 53 | UNIQUE (map_id, category_id, score_count) | ||
| 53 | ); | 54 | ); |
| 54 | 55 | ||
| 55 | CREATE TABLE map_history ( | 56 | CREATE TABLE map_history ( |
| @@ -61,7 +62,8 @@ CREATE TABLE map_history ( | |||
| 61 | record_date TIMESTAMP NOT NULL, | 62 | record_date TIMESTAMP NOT NULL, |
| 62 | PRIMARY KEY (id), | 63 | PRIMARY KEY (id), |
| 63 | FOREIGN KEY (category_id) REFERENCES categories(id), | 64 | FOREIGN KEY (category_id) REFERENCES categories(id), |
| 64 | FOREIGN KEY (map_id) REFERENCES maps(id) | 65 | FOREIGN KEY (map_id) REFERENCES maps(id), |
| 66 | UNIQUE (map_id, category_id, score_count) | ||
| 65 | ); | 67 | ); |
| 66 | 68 | ||
| 67 | CREATE TABLE map_ratings ( | 69 | CREATE TABLE map_ratings ( |
diff --git a/backend/database/route.sql b/backend/database/route.sql index 6f090c7..f26180e 100644 --- a/backend/database/route.sql +++ b/backend/database/route.sql | |||
| @@ -27,7 +27,7 @@ INSERT INTO map_routes(map_id,category_id,score_count,description,showcase) VALU | |||
| 27 | (15,1,2,'',''), | 27 | (15,1,2,'',''), |
| 28 | (16,1,2,'',''), | 28 | (16,1,2,'',''), |
| 29 | (16,1,0,'',''), | 29 | (16,1,0,'',''), |
| 30 | (17,1,0,'',''), | 30 | (17,1,2,'',''), |
| 31 | (17,1,0,'',''), | 31 | (17,1,0,'',''), |
| 32 | -- 3 | 32 | -- 3 |
| 33 | (18,1,5,'',''), | 33 | (18,1,5,'',''), |