윤준석

ADD: deploy.sh and undeploy.sh for testing deployment and undeployment db container

1 +#!/usr/bin/env bash
2 +
3 +docker build -t mamuri-db .
4 +docker-compose up -d
...\ No newline at end of file ...\ No newline at end of file
1 CREATE DATABASE mamuri_db; 1 CREATE DATABASE mamuri_db;
2 2
3 +USE mamuri_db;
4 +
3 CREATE TABLE user 5 CREATE TABLE user
4 ( 6 (
5 - id INT(10) NULL AUTO_INCREMENT 7 + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
8 + user_id INT NOT NULL
6 ); 9 );
7 10
8 CREATE TABLE keyword 11 CREATE TABLE keyword
9 ( 12 (
10 - id INT NOT NULL, 13 + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
11 keyword VARCHAR NULL 14 keyword VARCHAR NULL
12 ); 15 );
13 16
14 CREATE TABLE user_keyword 17 CREATE TABLE user_keyword
15 ( 18 (
16 - id INT NOT NULL AUTO_INCREMENT, 19 + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
17 user_id INT NOT NULL, 20 user_id INT NOT NULL,
18 keyword_id INT NOT NULL, 21 keyword_id INT NOT NULL,
19 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE, 22 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
...@@ -22,7 +25,7 @@ CREATE TABLE user_keyword ...@@ -22,7 +25,7 @@ CREATE TABLE user_keyword
22 25
23 CREATE TABLE item 26 CREATE TABLE item
24 ( 27 (
25 - id INT NOT NULL, 28 + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
26 keyword_id INT NOT NULL, 29 keyword_id INT NOT NULL,
27 platform VARCHAR NOT NULL, 30 platform VARCHAR NOT NULL,
28 name VARCHAR NOT NULL, 31 name VARCHAR NOT NULL,
...@@ -35,7 +38,7 @@ CREATE TABLE item ...@@ -35,7 +38,7 @@ CREATE TABLE item
35 38
36 CREATE TABLE item_check 39 CREATE TABLE item_check
37 ( 40 (
38 - id INT NOT NULL AUTO_INCREMENT, 41 + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
39 item_id INT NULL, 42 item_id INT NULL,
40 user_id INT NULL, 43 user_id INT NULL,
41 FOREIGN KEY (item_id) REFERENCES item (id) ON DELETE CASCADE, 44 FOREIGN KEY (item_id) REFERENCES item (id) ON DELETE CASCADE,
......
1 +#!/usr/bin/env bash
2 +
3 +docker-compose down
4 +docker image rm mamuri-db
...\ No newline at end of file ...\ No newline at end of file