-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2 스키마 수정
- Loading branch information
Showing
1 changed file
with
36 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
DROP TABLE IF EXISTS image; | ||
DROP TABLE IF EXISTS booking; | ||
DROP TABLE IF EXISTS accommodation; | ||
DROP TABLE IF EXISTS location; | ||
DROP TABLE IF EXISTS user; | ||
# DROP TABLE IF EXISTS image; | ||
# DROP TABLE IF EXISTS booking; | ||
# DROP TABLE IF EXISTS accommodation; | ||
# DROP TABLE IF EXISTS location; | ||
# DROP TABLE IF EXISTS user; | ||
|
||
CREATE TABLE IF NOT EXISTS user ( | ||
id BIGINT, | ||
email VARCHAR(32), | ||
id BIGINT AUTO_INCREMENT, | ||
email VARCHAR(64), | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS location ( | ||
id BIGINT, | ||
country VARCHAR(32), | ||
city VARCHAR(32), | ||
id BIGINT AUTO_INCREMENT, | ||
country VARCHAR(64), | ||
city VARCHAR(64), | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS accommodation ( | ||
id BIGINT, | ||
name VARCHAR(64), | ||
maximum_accommodates SMALLINT, | ||
minimum_nights TINYINT, | ||
maximum_nights SMALLINT, | ||
original_price FLOAT(3,2), | ||
sale_price FLOAT(3,2), | ||
cleaning_fee FLOAT(3,2), | ||
badge TINYINT(1), | ||
grade FLOAT(2,1), | ||
location BIGINT, | ||
id BIGINT AUTO_INCREMENT, | ||
name VARCHAR(256), | ||
description VARCHAR(256), | ||
maximum_accommodates SMALLINT, | ||
minimum_nights SMALLINT, | ||
maximum_nights SMALLINT, | ||
original_price FLOAT(3, 2), | ||
sale_price FLOAT(3, 2), | ||
cleaning_fee FLOAT(3, 2), | ||
badge TINYINT(1), | ||
grade FLOAT(3, 2), | ||
location BIGINT, | ||
PRIMARY KEY (id), | ||
FOREIGN KEY (location) REFERENCES location (id) | ||
|
||
); | ||
|
||
CREATE TABLE IF NOT EXISTS booking ( | ||
id BIGINT, | ||
accommodates TINYINT, | ||
nights SMALLINT, | ||
final_price FLOAT(3,2), | ||
begin_date DATE, | ||
end_date DATE, | ||
bookable TINYINT(1), | ||
tourism_tax FLOAT(3,2), | ||
user BIGINT, | ||
accommodation BIGINT, | ||
id BIGINT, | ||
accommodates TINYINT, | ||
nights SMALLINT, | ||
final_price FLOAT(3, 2), | ||
begin_date DATE, | ||
end_date DATE, | ||
bookable TINYINT(1), | ||
tourism_tax FLOAT(3, 2), | ||
user BIGINT, | ||
accommodation BIGINT, | ||
PRIMARY KEY (id), | ||
FOREIGN KEY (user) REFERENCES user (id), | ||
FOREIGN KEY (accommodation) REFERENCES accommodation (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS image ( | ||
id BIGINT, | ||
url VARCHAR(256), | ||
accommodation BIGINT, | ||
id BIGINT AUTO_INCREMENT, | ||
url VARCHAR(256), | ||
accommodation BIGINT, | ||
PRIMARY KEY (id), | ||
FOREIGN KEY (accommodation) REFERENCES accommodation (id) | ||
); | ||
); |