FIX: Database initialization and .env example
Remove createion of table and relationship because of sequelize in nodejs server create this relation
Showing
2 changed files
with
1 additions
and
45 deletions
1 | CREATE DATABASE mamuri_db; | 1 | CREATE DATABASE mamuri_db; |
2 | - | ||
3 | -USE mamuri_db; | ||
4 | - | ||
5 | -CREATE TABLE user | ||
6 | -( | ||
7 | - id INT AUTO_INCREMENT PRIMARY KEY, | ||
8 | - user_id INT NOT NULL | ||
9 | -); | ||
10 | - | ||
11 | -CREATE TABLE keyword | ||
12 | -( | ||
13 | - id INT AUTO_INCREMENT PRIMARY KEY, | ||
14 | - keyword VARCHAR(150) NULL | ||
15 | -); | ||
16 | - | ||
17 | -CREATE TABLE user_keyword | ||
18 | -( | ||
19 | - id INT AUTO_INCREMENT PRIMARY KEY, | ||
20 | - user_id INT NOT NULL, | ||
21 | - keyword_id INT NOT NULL, | ||
22 | - FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE, | ||
23 | - FOREIGN KEY (keyword_id) REFERENCES keyword (id) ON DELETE CASCADE | ||
24 | -); | ||
25 | - | ||
26 | -CREATE TABLE item | ||
27 | -( | ||
28 | - id INT AUTO_INCREMENT PRIMARY KEY, | ||
29 | - keyword_id INT NOT NULL, | ||
30 | - platform VARCHAR(50) NOT NULL, | ||
31 | - name VARCHAR(100) NOT NULL, | ||
32 | - price INT NOT NULL, | ||
33 | - thumbnail_url VARCHAR(255) NULL, | ||
34 | - item_url VARCHAR(255) NOT NULL, | ||
35 | - extra_info TEXT NULL, | ||
36 | - created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
37 | -); | ||
38 | - | ||
39 | -CREATE TABLE item_check | ||
40 | -( | ||
41 | - id INT AUTO_INCREMENT PRIMARY KEY, | ||
42 | - item_id INT NULL, | ||
43 | - user_id INT NULL, | ||
44 | - FOREIGN KEY (item_id) REFERENCES item (id) ON DELETE CASCADE, | ||
45 | - FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE | ||
46 | -); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment