Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#3 db 설계 hoon #21

Closed
wants to merge 2 commits into from
Closed

Feat/#3 db 설계 hoon #21

wants to merge 2 commits into from

Conversation

hoon25
Copy link
Contributor

@hoon25 hoon25 commented Jun 11, 2022

Description

DB설계 ERD 제안입니다.
air_jnc_ERD

변경 사항

  • room이 동일한 host, address 기준으로 묶여야 합니다.
  • auto_increment id값들 타입전체 변경 INT -> BIGINT

질문 사항

  • 코드값이 상위 그룹을 가지고 있을 때 (room_facility_code 관련)
    • 계층형테이블 vs 일대다테이블 추가

기타

  • SQL 생성 문
    • FK가 논리적설계에는 존재하지만 물리적설계에서는 성능상의 이슈로 제거하였습니다.
CREATE TABLE `room` (
                        `id` bigint auto_increment primary key,
                        `title` varchar(50),
                        `description` varchar(1000),
                        `bedroom_count` int,
                        `bathroom_count` int,
                        `bed_count` int,
                        `max_people` int,
                        `host_question` varchar(1000),
                        `room_checkin_time` varchar(20),
                        `room_checkout_time` varchar(20),
                        `host_room_address_id` bigint,
                        `host_id` varchar(200)
);

CREATE TABLE `room_price` (
                              `id` bigint auto_increment primary key,
                              `start_date` datetime,
                              `end_date` datetime,
                              `price` bigint,
                              `currency` varchar(20),
                              `room_id` bigint);

CREATE TABLE `room_facility_code` (
                                      `id` bigint auto_increment primary key,
                                      `upr_id` bigint,
                                      `name` varchar(50),
                                      `description` varchar(200)
);

CREATE TABLE `room_facility` (
                                 `id` bigint auto_increment primary key,
                                 `room_id` bigint,
                                 `facility_id` varchar(50)
);

CREATE TABLE `user` (
                        `id` bigint auto_increment primary key,
                        `email` varchar(50),
                        `password` varchar(100),
                        `name` varchar(100),
                        `nickname` varchar(100),
                        `gender` varchar(20),
                        `birthdate` datetime,
                        `address` varchar(200),
                        `phone_number` varchar(20),
                        `active_yn` varchar(10),
                        `last_access_date` datetime,
                        `first_create_date` datetime,
                        `last_update_date` datetime
);

CREATE TABLE `host` (
                        `id` bigint auto_increment primary key,
                        `photo_url` varchar(200),
                        `description` varchar(200),
                        `user_id` varchar(200)
);

CREATE TABLE `room_reservation` (
                                    `id` bigint auto_increment primary key,
                                    `stay_start_date` datetime,
                                    `stay_end_date` datetime,
                                    `guest_people_cnt` int,
                                    `reservation_regist_time` datetime,
                                    `reservation_accept_time` datetime,
                                    `reservation_status` varchar(10),
                                    `guest_id` bigint,
                                    `room_id` bigint
);

CREATE TABLE `room_category_code` (
                                      `id` bigint auto_increment primary key,
                                      `category_name` varchar(50)
);

CREATE TABLE `room_category` (
                                 `id` bigint auto_increment primary key,
                                 `order` int,
                                 `category_id` bigint,
                                 `room_id` bigint
);

CREATE TABLE `room_review` (
                               `id` bigint auto_increment primary key,
                               `review_title` varchar(100),
                               `review_content` varchar(1000),
                               `stay_start_date` datetime,
                               `stay_end_date` datetime,
                               `first_create_date` datetime,
                               `last_update_date` datetime,
                               `user_id` bigint,
                               `room_id` bigint
);

CREATE TABLE `room_photo` (
                              `id` bigint auto_increment primary key,
                              `photo_url` varchar(200),
                              `order` int,
                              `room_id` bigint
);

CREATE TABLE `room_wish` (
                             `id` bigint auto_increment primary key,
                             `first_create_date` datetime,
                             `user_id` bigint,
                             `room_id` bigint
);

CREATE TABLE `host_address` (
                                `id` bigint auto_increment primary key,
                                `address` varchar(200),
                                `host_id` bigint
);

CREATE TABLE `host_room_address` (
                                     `host_room_address_id` bigint auto_increment primary key,
                                     `room_id` bigint
);

CREATE TABLE `room_address_facility` (
                                         `id` bigint auto_increment primary key,
                                         `room_address_id` bigint,
                                         `facility_id` varchar(50)
);

@memoer memoer closed this Jun 14, 2022
@memoer memoer deleted the feat/#3-DB_설계-hoon branch June 14, 2022 16:25
@hoon25 hoon25 added the Type: Setting 개발 환경 설정 label Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Setting 개발 환경 설정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DB 설계
2 participants