Skip to content

Commit

Permalink
feat 🚀 데이터 베이스 스키마 수정
Browse files Browse the repository at this point in the history
#2 스키마 수정
  • Loading branch information
sedin2 committed May 21, 2020
1 parent 75d856e commit bb4c04a
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions BE/src/main/resources/schema.sql
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)
);
);

0 comments on commit bb4c04a

Please sign in to comment.