장소 리스트 자료조사 (토토로)
docker run --name isekaidb -e MYSQL_ROOT_PASSWORD=isekai00 -e MYSQL_DATABASE=isekai -e MYSQL_USER=user -e MYSQL_PASSWORD=isekai00 -p 19991:3306 -v mysql-data:/var/lib/mysql -d mysql:latest
CREATE TABLE Animation (
idx INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
detail TEXT NOT NULL,
image_path VARCHAR(255) NOT NULL
);
CREATE TABLE UserTable (
idx INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
nickname VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
salt VARCHAR(45)
);
~~CREATE TABLE Site (
idx INT AUTO_INCREMENT PRIMARY KEY,
site_name VARCHAR(255) NOT NULL,
latitude DECIMAL(9,6) NOT NULL,
longitude DECIMAL(9,6) NOT NULL,
is_family_friendly BOOLEAN NOT NULL
);~~
CREATE TABLE Site (
idx INT AUTO_INCREMENT PRIMARY KEY,
site_name VARCHAR(255) NOT NULL,
latitude DECIMAL(9,6) NOT NULL,
longitude DECIMAL(9,6) NOT NULL,
is_family_friendly BOOLEAN NOT NULL,
ani_idx INT,
image_path NOT NULL,
FOREIGN KEY (ani_idx) REFERENCES Animation(idx)
);
CREATE TABLE Favorites (
idx INT AUTO_INCREMENT PRIMARY KEY,
user_idx INT NOT NULL,
site_idx INT NOT NULL,
FOREIGN KEY (user_idx) REFERENCES UserTable(idx),
FOREIGN KEY (site_idx) REFERENCES Site(idx)
);
CREATE TABLE Dislikes (
idx INT AUTO_INCREMENT PRIMARY KEY,
user_idx INT NOT NULL,
site_idx INT NOT NULL,
FOREIGN KEY (user_idx) REFERENCES UserTable(idx),
FOREIGN KEY (site_idx) REFERENCES Site(idx)
);
CREATE TABLE Tags (
idx INT AUTO_INCREMENT PRIMARY KEY,
site_idx INT NOT NULL,
tags VARCHAR(255) NOT NULL,
FOREIGN KEY (site_idx) REFERENCES Site(idx)
);
~~CREATE TABLE AnimationSites (
idx INT AUTO_INCREMENT PRIMARY KEY,
ani_idx INT NOT NULL,
site_idx INT NOT NULL,
FOREIGN KEY (ani_idx) REFERENCES Animation(idx),
FOREIGN KEY (site_idx) REFERENCES Site(idx)
);~~