From f72d0fda6ce3c57d684f82b00f4a3b37b012527c Mon Sep 17 00:00:00 2001 From: Masco Skray Date: Wed, 10 Jul 2019 11:04:51 +0800 Subject: [PATCH] style(web): merge contests_asks table into main sql file The web interface is merged but the table is not. Merge it into a single SQL file, without execute PHP. Redumped database structure with mysqldump command. --- install/bundle/app_uoj233.sql | 837 +++++++++++-------- web/app/upgrade/1_create_table_asks/down.sql | 1 - web/app/upgrade/1_create_table_asks/up.sql | 9 - web/app/upgrade/2_alter_table_asks/down.sql | 1 - web/app/upgrade/2_alter_table_asks/up.sql | 1 - 5 files changed, 467 insertions(+), 382 deletions(-) delete mode 100644 web/app/upgrade/1_create_table_asks/down.sql delete mode 100644 web/app/upgrade/1_create_table_asks/up.sql delete mode 100644 web/app/upgrade/2_alter_table_asks/down.sql delete mode 100644 web/app/upgrade/2_alter_table_asks/up.sql diff --git a/install/bundle/app_uoj233.sql b/install/bundle/app_uoj233.sql index 13186ab..68fb5b7 100644 --- a/install/bundle/app_uoj233.sql +++ b/install/bundle/app_uoj233.sql @@ -1,34 +1,35 @@ --- phpMyAdmin SQL Dump --- version 4.2.7.1 --- http://www.phpmyadmin.net +-- MySQL dump 10.13 Distrib 5.7.25, for Linux (x86_64) -- --- Host: localhost --- Generation Time: 2016-08-29 09:19:31 --- 服务器版本: 5.5.38-0ubuntu0.14.04.1 --- PHP Version: 5.5.9-1ubuntu4.4 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - +-- Host: localhost Database: app_uoj233 +-- ------------------------------------------------------ +-- Server version 5.7.25-0ubuntu0.18.04.2 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+08:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- --- Database: `app_uoj233` +-- Current Database: `app_uoj233` -- -CREATE DATABASE IF NOT EXISTS `app_uoj233` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `app_uoj233` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + USE `app_uoj233`; --- -------------------------------------------------------- - -- --- 表的结构 `best_ac_submissions` +-- Table structure for table `best_ac_submissions` -- -CREATE TABLE IF NOT EXISTS `best_ac_submissions` ( +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `best_ac_submissions` ( `problem_id` int(11) NOT NULL, `submitter` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `submission_id` int(11) NOT NULL, @@ -38,17 +39,28 @@ CREATE TABLE IF NOT EXISTS `best_ac_submissions` ( `shortest_id` int(11) NOT NULL, `shortest_used_time` int(11) NOT NULL, `shortest_used_memory` int(11) NOT NULL, - `shortest_tot_size` int(11) NOT NULL + `shortest_tot_size` int(11) NOT NULL, + PRIMARY KEY (`problem_id`,`submitter`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `blogs` +-- Dumping data for table `best_ac_submissions` -- -CREATE TABLE IF NOT EXISTS `blogs` ( -`id` int(11) NOT NULL, +LOCK TABLES `best_ac_submissions` WRITE; +/*!40000 ALTER TABLE `best_ac_submissions` DISABLE KEYS */; +/*!40000 ALTER TABLE `best_ac_submissions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `blogs` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `blogs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `title` text COLLATE utf8_unicode_ci NOT NULL, `content` mediumtext COLLATE utf8_unicode_ci NOT NULL, `post_time` datetime NOT NULL, @@ -57,139 +69,279 @@ CREATE TABLE IF NOT EXISTS `blogs` ( `zan` int(11) NOT NULL, `is_hidden` tinyint(1) NOT NULL, `type` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'B', - `is_draft` tinyint(1) NOT NULL DEFAULT '0' -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- -------------------------------------------------------- + `is_draft` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `blogs_comments` +-- Dumping data for table `blogs` -- -CREATE TABLE IF NOT EXISTS `blogs_comments` ( -`id` int(11) NOT NULL, +LOCK TABLES `blogs` WRITE; +/*!40000 ALTER TABLE `blogs` DISABLE KEYS */; +/*!40000 ALTER TABLE `blogs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `blogs_comments` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `blogs_comments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `blog_id` int(11) NOT NULL, `content` text COLLATE utf8_unicode_ci NOT NULL, `post_time` datetime NOT NULL, `poster` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `zan` int(11) NOT NULL, - `reply_id` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- -------------------------------------------------------- + `reply_id` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `blogs_tags` +-- Dumping data for table `blogs_comments` -- -CREATE TABLE IF NOT EXISTS `blogs_tags` ( -`id` int(11) NOT NULL, +LOCK TABLES `blogs_comments` WRITE; +/*!40000 ALTER TABLE `blogs_comments` DISABLE KEYS */; +/*!40000 ALTER TABLE `blogs_comments` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `blogs_tags` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `blogs_tags` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `blog_id` int(11) NOT NULL, - `tag` varchar(30) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `tag` varchar(30) NOT NULL, + PRIMARY KEY (`id`), + KEY `blog_id` (`blog_id`), + KEY `tag` (`tag`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `click_zans` +-- Dumping data for table `blogs_tags` -- -CREATE TABLE IF NOT EXISTS `click_zans` ( +LOCK TABLES `blogs_tags` WRITE; +/*!40000 ALTER TABLE `blogs_tags` DISABLE KEYS */; +/*!40000 ALTER TABLE `blogs_tags` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `click_zans` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `click_zans` ( `type` char(2) COLLATE utf8_unicode_ci NOT NULL, `username` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `target_id` int(11) NOT NULL, - `val` tinyint(4) NOT NULL DEFAULT '1' + `val` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`type`,`target_id`,`username`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `contests` +-- Dumping data for table `click_zans` -- -CREATE TABLE IF NOT EXISTS `contests` ( -`id` int(11) NOT NULL, +LOCK TABLES `click_zans` WRITE; +/*!40000 ALTER TABLE `click_zans` DISABLE KEYS */; +/*!40000 ALTER TABLE `click_zans` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contests` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contests` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `start_time` datetime NOT NULL, `last_min` int(11) NOT NULL, `player_num` int(11) NOT NULL, `status` varchar(50) NOT NULL, `extra_config` varchar(200) NOT NULL, - `zan` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `zan` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `contests_notice` +-- Dumping data for table `contests` -- -CREATE TABLE IF NOT EXISTS `contests_notice` ( +LOCK TABLES `contests` WRITE; +/*!40000 ALTER TABLE `contests` DISABLE KEYS */; +/*!40000 ALTER TABLE `contests` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contests_asks` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contests_asks` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `contest_id` int(11) NOT NULL, + `username` varchar(20) NOT NULL, + `question` text NOT NULL, + `answer` text NOT NULL, + `post_time` datetime NOT NULL, + `reply_time` datetime NOT NULL, + `is_hidden` tinyint(1) DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `contests_asks` +-- + +LOCK TABLES `contests_asks` WRITE; +/*!40000 ALTER TABLE `contests_asks` DISABLE KEYS */; +/*!40000 ALTER TABLE `contests_asks` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contests_notice` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contests_notice` ( `contest_id` int(11) NOT NULL, `title` varchar(30) NOT NULL, `content` varchar(500) NOT NULL, - `time` datetime NOT NULL + `time` datetime NOT NULL, + KEY `contest_id` (`contest_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `contests_permissions` +-- Dumping data for table `contests_notice` -- -CREATE TABLE IF NOT EXISTS `contests_permissions` ( +LOCK TABLES `contests_notice` WRITE; +/*!40000 ALTER TABLE `contests_notice` DISABLE KEYS */; +/*!40000 ALTER TABLE `contests_notice` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contests_permissions` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contests_permissions` ( `username` varchar(20) NOT NULL, - `contest_id` int(11) NOT NULL + `contest_id` int(11) NOT NULL, + PRIMARY KEY (`username`,`contest_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `contests_problems` +-- Dumping data for table `contests_permissions` -- -CREATE TABLE IF NOT EXISTS `contests_problems` ( +LOCK TABLES `contests_permissions` WRITE; +/*!40000 ALTER TABLE `contests_permissions` DISABLE KEYS */; +/*!40000 ALTER TABLE `contests_permissions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contests_problems` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contests_problems` ( `problem_id` int(11) NOT NULL, - `contest_id` int(11) NOT NULL + `contest_id` int(11) NOT NULL, + PRIMARY KEY (`problem_id`,`contest_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `contests_registrants` +-- Dumping data for table `contests_problems` -- -CREATE TABLE IF NOT EXISTS `contests_registrants` ( +LOCK TABLES `contests_problems` WRITE; +/*!40000 ALTER TABLE `contests_problems` DISABLE KEYS */; +/*!40000 ALTER TABLE `contests_problems` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contests_registrants` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contests_registrants` ( `username` varchar(20) NOT NULL, `user_rating` int(11) NOT NULL, `contest_id` int(11) NOT NULL, `has_participated` tinyint(1) NOT NULL, - `rank` int(11) NOT NULL + `rank` int(11) NOT NULL, + PRIMARY KEY (`contest_id`,`username`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `contests_submissions` +-- Dumping data for table `contests_registrants` -- -CREATE TABLE IF NOT EXISTS `contests_submissions` ( +LOCK TABLES `contests_registrants` WRITE; +/*!40000 ALTER TABLE `contests_registrants` DISABLE KEYS */; +/*!40000 ALTER TABLE `contests_registrants` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contests_submissions` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contests_submissions` ( `contest_id` int(11) NOT NULL, `submitter` varchar(20) NOT NULL, `problem_id` int(11) NOT NULL, `submission_id` int(11) NOT NULL, `score` int(11) NOT NULL, - `penalty` int(11) NOT NULL + `penalty` int(11) NOT NULL, + PRIMARY KEY (`contest_id`,`submitter`,`problem_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `custom_test_submissions` +-- Dumping data for table `contests_submissions` -- -CREATE TABLE IF NOT EXISTS `custom_test_submissions` ( -`id` int(10) unsigned NOT NULL, +LOCK TABLES `contests_submissions` WRITE; +/*!40000 ALTER TABLE `contests_submissions` DISABLE KEYS */; +/*!40000 ALTER TABLE `contests_submissions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `custom_test_submissions` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `custom_test_submissions` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `problem_id` int(10) unsigned NOT NULL, `submit_time` datetime NOT NULL, `submitter` varchar(20) NOT NULL, @@ -197,17 +349,28 @@ CREATE TABLE IF NOT EXISTS `custom_test_submissions` ( `judge_time` datetime DEFAULT NULL, `result` blob NOT NULL, `status` varchar(20) NOT NULL, - `status_details` varchar(100) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `status_details` varchar(100) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `hacks` +-- Dumping data for table `custom_test_submissions` -- -CREATE TABLE IF NOT EXISTS `hacks` ( -`id` int(10) unsigned NOT NULL, +LOCK TABLES `custom_test_submissions` WRITE; +/*!40000 ALTER TABLE `custom_test_submissions` DISABLE KEYS */; +/*!40000 ALTER TABLE `custom_test_submissions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `hacks` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hacks` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `problem_id` int(10) unsigned NOT NULL, `contest_id` int(10) unsigned DEFAULT NULL, `submission_id` int(10) unsigned NOT NULL, @@ -219,40 +382,75 @@ CREATE TABLE IF NOT EXISTS `hacks` ( `judge_time` datetime DEFAULT NULL, `success` tinyint(1) DEFAULT NULL, `details` blob NOT NULL, - `is_hidden` tinyint(1) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `is_hidden` tinyint(1) NOT NULL, + PRIMARY KEY (`id`), + KEY `submission_id` (`submission_id`), + KEY `is_hidden` (`is_hidden`,`problem_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `important_blogs` +-- Dumping data for table `hacks` -- -CREATE TABLE IF NOT EXISTS `important_blogs` ( +LOCK TABLES `hacks` WRITE; +/*!40000 ALTER TABLE `hacks` DISABLE KEYS */; +/*!40000 ALTER TABLE `hacks` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `important_blogs` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `important_blogs` ( `blog_id` int(11) NOT NULL, - `level` int(11) NOT NULL + `level` int(11) NOT NULL, + PRIMARY KEY (`blog_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `judger_info` +-- Dumping data for table `important_blogs` -- -CREATE TABLE IF NOT EXISTS `judger_info` ( +LOCK TABLES `important_blogs` WRITE; +/*!40000 ALTER TABLE `important_blogs` DISABLE KEYS */; +/*!40000 ALTER TABLE `important_blogs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `judger_info` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `judger_info` ( `judger_name` varchar(50) NOT NULL, `password` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `ip` char(20) NOT NULL + `ip` char(20) NOT NULL, + PRIMARY KEY (`judger_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `problems` +-- Dumping data for table `judger_info` -- -CREATE TABLE IF NOT EXISTS `problems` ( -`id` int(10) unsigned NOT NULL, +LOCK TABLES `judger_info` WRITE; +/*!40000 ALTER TABLE `judger_info` DISABLE KEYS */; +/*!40000 ALTER TABLE `judger_info` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `problems` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `problems` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` text NOT NULL, `is_hidden` tinyint(1) NOT NULL DEFAULT '0', `submission_requirement` text, @@ -260,69 +458,128 @@ CREATE TABLE IF NOT EXISTS `problems` ( `extra_config` varchar(500) NOT NULL DEFAULT '{"view_content_type":"ALL","view_details_type":"ALL"}', `zan` int(11) NOT NULL, `ac_num` int(11) NOT NULL DEFAULT '0', - `submit_num` int(11) NOT NULL DEFAULT '0' -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `submit_num` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `problems_contents` +-- Dumping data for table `problems` -- -CREATE TABLE IF NOT EXISTS `problems_contents` ( +LOCK TABLES `problems` WRITE; +/*!40000 ALTER TABLE `problems` DISABLE KEYS */; +/*!40000 ALTER TABLE `problems` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `problems_contents` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `problems_contents` ( `id` int(11) NOT NULL, `statement` mediumtext NOT NULL, - `statement_md` mediumtext NOT NULL + `statement_md` mediumtext NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `problems_permissions` +-- Dumping data for table `problems_contents` -- -CREATE TABLE IF NOT EXISTS `problems_permissions` ( +LOCK TABLES `problems_contents` WRITE; +/*!40000 ALTER TABLE `problems_contents` DISABLE KEYS */; +/*!40000 ALTER TABLE `problems_contents` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `problems_permissions` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `problems_permissions` ( `username` varchar(20) NOT NULL, - `problem_id` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- 表的结构 `problems_tags` --- - -CREATE TABLE IF NOT EXISTS `problems_tags` ( -`id` int(11) NOT NULL, `problem_id` int(11) NOT NULL, - `tag` varchar(30) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + PRIMARY KEY (`username`,`problem_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `search_requests` +-- Dumping data for table `problems_permissions` -- -CREATE TABLE IF NOT EXISTS `search_requests` ( -`id` int(11) NOT NULL, +LOCK TABLES `problems_permissions` WRITE; +/*!40000 ALTER TABLE `problems_permissions` DISABLE KEYS */; +/*!40000 ALTER TABLE `problems_permissions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `problems_tags` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `problems_tags` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `problem_id` int(11) NOT NULL, + `tag` varchar(30) NOT NULL, + PRIMARY KEY (`id`), + KEY `problem_id` (`problem_id`), + KEY `tag` (`tag`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `problems_tags` +-- + +LOCK TABLES `problems_tags` WRITE; +/*!40000 ALTER TABLE `problems_tags` DISABLE KEYS */; +/*!40000 ALTER TABLE `problems_tags` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `search_requests` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `search_requests` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `created_at` datetime NOT NULL, `remote_addr` varchar(50) NOT NULL, `type` enum('search','autocomplete') NOT NULL, `cache_id` int(11) NOT NULL, `q` varchar(100) NOT NULL, `content` text NOT NULL, - `result` mediumtext NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `result` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `remote_addr` (`remote_addr`,`created_at`), + KEY `created_at` (`created_at`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `submissions` +-- Dumping data for table `search_requests` -- -CREATE TABLE IF NOT EXISTS `submissions` ( -`id` int(10) unsigned NOT NULL, +LOCK TABLES `search_requests` WRITE; +/*!40000 ALTER TABLE `search_requests` DISABLE KEYS */; +/*!40000 ALTER TABLE `search_requests` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `submissions` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `submissions` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `problem_id` int(10) unsigned NOT NULL, `contest_id` int(10) unsigned DEFAULT NULL, `submit_time` datetime NOT NULL, @@ -338,16 +595,28 @@ CREATE TABLE IF NOT EXISTS `submissions` ( `used_time` int(11) NOT NULL DEFAULT '0', `used_memory` int(11) NOT NULL DEFAULT '0', `is_hidden` tinyint(1) NOT NULL, - `status_details` varchar(100) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `status_details` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + KEY `is_hidden` (`is_hidden`,`problem_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `user_info` +-- Dumping data for table `submissions` -- -CREATE TABLE IF NOT EXISTS `user_info` ( +LOCK TABLES `submissions` WRITE; +/*!40000 ALTER TABLE `submissions` DISABLE KEYS */; +/*!40000 ALTER TABLE `submissions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_info` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_info` ( `usergroup` char(1) NOT NULL DEFAULT 'U', `username` varchar(20) NOT NULL, `email` varchar(50) NOT NULL, @@ -361,251 +630,79 @@ CREATE TABLE IF NOT EXISTS `user_info` ( `remote_addr` varchar(50) NOT NULL, `http_x_forwarded_for` varchar(50) NOT NULL, `remember_token` char(60) NOT NULL, - `motto` varchar(200) NOT NULL + `motto` varchar(200) NOT NULL, + PRIMARY KEY (`username`), + KEY `rating` (`rating`,`username`), + KEY `ac_num` (`ac_num`,`username`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `user_msg` +-- Dumping data for table `user_info` -- -CREATE TABLE IF NOT EXISTS `user_msg` ( -`id` int(10) unsigned NOT NULL, +LOCK TABLES `user_info` WRITE; +/*!40000 ALTER TABLE `user_info` DISABLE KEYS */; +/*!40000 ALTER TABLE `user_info` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_msg` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_msg` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `sender` varchar(20) NOT NULL, `receiver` varchar(20) NOT NULL, `message` varchar(5000) NOT NULL, `send_time` datetime NOT NULL, - `read_time` datetime DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- + `read_time` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- 表的结构 `user_system_msg` +-- Dumping data for table `user_msg` -- -CREATE TABLE IF NOT EXISTS `user_system_msg` ( -`id` int(11) NOT NULL, +LOCK TABLES `user_msg` WRITE; +/*!40000 ALTER TABLE `user_msg` DISABLE KEYS */; +/*!40000 ALTER TABLE `user_msg` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_system_msg` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_system_msg` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `content` varchar(300) COLLATE utf8_unicode_ci NOT NULL, `receiver` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `send_time` datetime NOT NULL, - `read_time` datetime DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + `read_time` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- --- Indexes for dumped tables +-- Dumping data for table `user_system_msg` -- --- --- Indexes for table `best_ac_submissions` --- -ALTER TABLE `best_ac_submissions` - ADD PRIMARY KEY (`problem_id`,`submitter`); +LOCK TABLES `user_system_msg` WRITE; +/*!40000 ALTER TABLE `user_system_msg` DISABLE KEYS */; +/*!40000 ALTER TABLE `user_system_msg` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; --- --- Indexes for table `blogs` --- -ALTER TABLE `blogs` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `blogs_comments` --- -ALTER TABLE `blogs_comments` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `blogs_tags` --- -ALTER TABLE `blogs_tags` - ADD PRIMARY KEY (`id`), ADD KEY `blog_id` (`blog_id`), ADD KEY `tag` (`tag`); - --- --- Indexes for table `click_zans` --- -ALTER TABLE `click_zans` - ADD PRIMARY KEY (`type`,`target_id`,`username`); - --- --- Indexes for table `contests` --- -ALTER TABLE `contests` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `contests_notice` --- -ALTER TABLE `contests_notice` - ADD KEY `contest_id` (`contest_id`); - --- --- Indexes for table `contests_permissions` --- -ALTER TABLE `contests_permissions` - ADD PRIMARY KEY (`username`,`contest_id`); - --- --- Indexes for table `contests_problems` --- -ALTER TABLE `contests_problems` - ADD PRIMARY KEY (`problem_id`,`contest_id`); - --- --- Indexes for table `contests_registrants` --- -ALTER TABLE `contests_registrants` - ADD PRIMARY KEY (`contest_id`,`username`); - --- --- Indexes for table `contests_submissions` --- -ALTER TABLE `contests_submissions` - ADD PRIMARY KEY (`contest_id`,`submitter`,`problem_id`); - --- --- Indexes for table `custom_test_submissions` --- -ALTER TABLE `custom_test_submissions` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `hacks` --- -ALTER TABLE `hacks` - ADD PRIMARY KEY (`id`), ADD KEY `submission_id` (`submission_id`), ADD KEY `is_hidden` (`is_hidden`,`problem_id`); - --- --- Indexes for table `important_blogs` --- -ALTER TABLE `important_blogs` - ADD PRIMARY KEY (`blog_id`); - --- --- Indexes for table `judger_info` --- -ALTER TABLE `judger_info` - ADD PRIMARY KEY (`judger_name`); - --- --- Indexes for table `problems` --- -ALTER TABLE `problems` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `problems_contents` --- -ALTER TABLE `problems_contents` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `problems_permissions` --- -ALTER TABLE `problems_permissions` - ADD PRIMARY KEY (`username`,`problem_id`); - --- --- Indexes for table `problems_tags` --- -ALTER TABLE `problems_tags` - ADD PRIMARY KEY (`id`), ADD KEY `problem_id` (`problem_id`), ADD KEY `tag` (`tag`); - --- --- Indexes for table `search_requests` --- -ALTER TABLE `search_requests` - ADD PRIMARY KEY (`id`), ADD KEY `remote_addr` (`remote_addr`,`created_at`), ADD KEY `created_at` (`created_at`); - --- --- Indexes for table `submissions` --- -ALTER TABLE `submissions` - ADD PRIMARY KEY (`id`), ADD KEY `is_hidden` (`is_hidden`,`problem_id`); - --- --- Indexes for table `user_info` --- -ALTER TABLE `user_info` - ADD PRIMARY KEY (`username`), ADD KEY `rating` (`rating`,`username`), ADD KEY `ac_num` (`ac_num`,`username`); - --- --- Indexes for table `user_msg` --- -ALTER TABLE `user_msg` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `user_system_msg` --- -ALTER TABLE `user_system_msg` - ADD PRIMARY KEY (`id`); - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `blogs` --- -ALTER TABLE `blogs` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `blogs_comments` --- -ALTER TABLE `blogs_comments` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `blogs_tags` --- -ALTER TABLE `blogs_tags` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `contests` --- -ALTER TABLE `contests` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `custom_test_submissions` --- -ALTER TABLE `custom_test_submissions` -MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `hacks` --- -ALTER TABLE `hacks` -MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `problems` --- -ALTER TABLE `problems` -MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `problems_tags` --- -ALTER TABLE `problems_tags` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `search_requests` --- -ALTER TABLE `search_requests` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `submissions` --- -ALTER TABLE `submissions` -MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `user_msg` --- -ALTER TABLE `user_msg` -MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT for table `user_system_msg` --- -ALTER TABLE `user_system_msg` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; diff --git a/web/app/upgrade/1_create_table_asks/down.sql b/web/app/upgrade/1_create_table_asks/down.sql deleted file mode 100644 index e52b535..0000000 --- a/web/app/upgrade/1_create_table_asks/down.sql +++ /dev/null @@ -1 +0,0 @@ -alter table contests_asks drop column is_hidden; diff --git a/web/app/upgrade/1_create_table_asks/up.sql b/web/app/upgrade/1_create_table_asks/up.sql deleted file mode 100644 index 873dc20..0000000 --- a/web/app/upgrade/1_create_table_asks/up.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE IF NOT EXISTS `contests_asks` ( - `id` int(11) NOT NULL primary key AUTO_INCREMENT, - `contest_id` int(11) NOT NULL, - `username` varchar(20) NOT NULL, - `question` text NOT NULL, - `answer` text NOT NULL, - `post_time` datetime NOT NULL, - `reply_time` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/web/app/upgrade/2_alter_table_asks/down.sql b/web/app/upgrade/2_alter_table_asks/down.sql deleted file mode 100644 index f00d915..0000000 --- a/web/app/upgrade/2_alter_table_asks/down.sql +++ /dev/null @@ -1 +0,0 @@ -drop table `contests_asks`; diff --git a/web/app/upgrade/2_alter_table_asks/up.sql b/web/app/upgrade/2_alter_table_asks/up.sql deleted file mode 100644 index a8e5858..0000000 --- a/web/app/upgrade/2_alter_table_asks/up.sql +++ /dev/null @@ -1 +0,0 @@ -alter table contests_asks add is_hidden boolean default false;