From 37843355cdf70360554d89cd19f869b0806c589a Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 22 Oct 2022 08:16:39 +0800 Subject: [PATCH] fix(db/submissions): add key for #8 --- db/app_uoj233.sql | 3 ++- web/app/upgrade/8_group_v2/down.sql | 1 + web/app/upgrade/8_group_v2/up.sql | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql index c33a8ce..4639640 100644 --- a/db/app_uoj233.sql +++ b/db/app_uoj233.sql @@ -775,7 +775,8 @@ CREATE TABLE `submissions` ( `is_hidden` tinyint(1) NOT NULL, `status_details` varchar(100) NOT NULL, PRIMARY KEY (`id`), - KEY `is_hidden` (`is_hidden`,`problem_id`) + KEY `is_hidden` (`is_hidden`,`problem_id`), + KEY `score` (`problem_id`, `submitter`, `score`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/web/app/upgrade/8_group_v2/down.sql b/web/app/upgrade/8_group_v2/down.sql index b77c2f6..16539d9 100644 --- a/web/app/upgrade/8_group_v2/down.sql +++ b/web/app/upgrade/8_group_v2/down.sql @@ -4,3 +4,4 @@ ALTER TABLE `assignments` DROP PRIMARY KEY, ADD PRIMARY KEY (`id`); ALTER TABLE `assignments` ADD COLUMN `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP; ALTER TABLE `assignments` CHANGE COLUMN `end_time` `deadline` datetime NOT NULL; ALTER TABLE `countdowns` CHANGE COLUMN `end_time` `endtime` datetime NOT NULL; +ALTER TABLE `submissions` DROP KEY `score`; diff --git a/web/app/upgrade/8_group_v2/up.sql b/web/app/upgrade/8_group_v2/up.sql index 03d5887..fa9af3b 100644 --- a/web/app/upgrade/8_group_v2/up.sql +++ b/web/app/upgrade/8_group_v2/up.sql @@ -4,3 +4,4 @@ ALTER TABLE `groups_assignments` ADD PRIMARY KEY (`group_id`, `list_id`); ALTER TABLE `groups_assignments` DROP COLUMN `create_time`; ALTER TABLE `groups_assignments` CHANGE COLUMN `deadline` `end_time` datetime NOT NULL; ALTER TABLE `countdowns` CHANGE COLUMN `endtime` `end_time` datetime NOT NULL; +ALTER TABLE `submissions` ADD KEY `score` (`problem_id`, `submitter`, `score`);