Skip to content

Commit

Permalink
Merge pull request #72 from traP-jp/fix/#58-db-scheme
Browse files Browse the repository at this point in the history
Fix/#58 db scheme
  • Loading branch information
kenken714 authored Dec 13, 2024
2 parents f71c610 + af4d5a8 commit 6c585ae
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions migrations/0_create-table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `users_passwords` (
);

CREATE TABLE IF NOT EXISTS `normal_problems` (
`problem_id` INT AUTO_INCREMENT PRIMARY KEY,
`id` INT AUTO_INCREMENT PRIMARY KEY,
`auther_id` INT NOT NULL,
`title` VARCHAR(255) NOT NULL,
`statement` TEXT NOT NULL,
Expand All @@ -29,30 +29,33 @@ CREATE TABLE IF NOT EXISTS `normal_problems` (
`difficulty` INT NOT NULL,
`is_public` BOOLEAN DEFAULT FALSE,
`judgecode_path` VARCHAR(255) NOT NULL,
`publish_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS `testcases` (
`testcase_id` INT AUTO_INCREMENT PRIMARY KEY,
`id` INT AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`path` VARCHAR(255) NOT NULL,
`problem_id` INT NOT NULL,
`testcase_name` VARCHAR(255) NOT NULL,
`testcase_path` VARCHAR(255) NOT NULL
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS `editiorials` (
`editorial_id` INT AUTO_INCREMENT PRIMARY KEY,
`id` INT AUTO_INCREMENT PRIMARY KEY,
`problem_id` INT NOT NULL,
`auther_id` INT NOT NULL,
`statement` TEXT NOT NULL,
`publish_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS `submissions` (
`submission_id` INT AUTO_INCREMENT PRIMARY KEY,
`id` INT AUTO_INCREMENT PRIMARY KEY,
`problem_id` INT NOT NULL,
`auther_id` INT NOT NULL,
`user_id` INT NOT NULL,
`user_name` VARCHAR(255) NOT NULL,
`language_id` INT NOT NULL,
`source` TEXT NOT NULL,
`judge_status` VARCHAR(4) NOT NULL,
Expand All @@ -63,8 +66,8 @@ CREATE TABLE IF NOT EXISTS `submissions` (
);

CREATE TABLE IF NOT EXISTS `submission_testcases` (
`testcase_id` INT AUTO_INCREMENT PRIMARY KEY,
`submission_id` INT NOT NULL,
`testcase_id` INT NOT NULL,
`testcase_name` VARCHAR(255) NOT NULL,
`judge_status` VARCHAR(4) NOT NULL,
`score` BIGINT NOT NULL,
Expand Down

0 comments on commit 6c585ae

Please sign in to comment.