Skip to content

Commit

Permalink
mysql のテーブルを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
H1rono committed Jun 17, 2022
1 parent 01dabab commit ce4e0da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ services:
mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: 22hack16
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=22hack16
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
volumes:
- ./mysql/data:/var/lib/mysql:z
- ./mysql/init:/docker-entrypoint-initdb.d:z
- ./mysql/data:/var/lib/mysql
- ./mysql/init:/docker-entrypoint-initdb.d
11 changes: 11 additions & 0 deletions mysql/init/create_db.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
DROP DATABASE IF EXISTS 22hack16;
CREATE DATABASE 22hack16;
USE 22hack16;

CREATE TABLE IF NOT EXISTS `codes` (
`user_name` varchar(32) NOT NULL,
`hash` char(8) NOT NULL,
`plain_code` text NOT NULL,
`stdin` text NOT NULL,
`title` varchar(64) NOT NULL,
`options` text NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`user_name`,`hash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

0 comments on commit ce4e0da

Please sign in to comment.