전세계적으로 유명한 숙박 공유 플랫폼 서비스인 에어비앤비 설계를 도전해봤다.
개념적 설계는 Draw.io를 사용했다.
논리적 설계는 EXERD 툴을 사용했다.
물리적 설계는 EXERD 툴을 사용했다.
-- 회원
CREATE TABLE "MY_SCHEMA"."members" (
"mem_id" INTEGER NOT NULL, -- 회원ID
"mem_knd" VARCHAR(4) NOT NULL, -- 회원종류
"mem_name" VARCHAR(50) NULL, -- 이름
"login" VARCHAR(255) NULL, -- 로그인ID
"password" VARCHAR(255) NULL, -- 패스워드
"email" VARCHAR(40) NULL, -- 이메일
"phone_number" VARCHAR(30) NULL, -- 핸드폰번호
"mem_content" TEXT NULL, -- 회원설명
"join_at" DATE NOT NULL, -- 가입일시
"confirm_status" VARCHAR(4) NULL, -- 승인상태
"confirm_at" DATE NULL, -- 승인일시
"update_at" DATE NULL, -- 수정일시
"out_at" DATE NULL -- 탈퇴일시
);
-- 회원 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_members"
ON "MY_SCHEMA"."members" ( -- 회원
"mem_id" ASC -- 회원ID
);
-- 회원
ALTER TABLE "MY_SCHEMA"."members"
ADD
CONSTRAINT "PK_members" -- 회원 기본키
PRIMARY KEY (
"mem_id" -- 회원ID
);
-- 회원
COMMENT ON TABLE "MY_SCHEMA"."members" IS '회원';
-- 회원ID
COMMENT ON COLUMN "MY_SCHEMA"."members"."mem_id" IS '회원ID';
-- 회원종류
COMMENT ON COLUMN "MY_SCHEMA"."members"."mem_knd" IS '회원종류';
-- 이름
COMMENT ON COLUMN "MY_SCHEMA"."members"."mem_name" IS '이름';
-- 로그인ID
COMMENT ON COLUMN "MY_SCHEMA"."members"."login" IS '로그인ID';
-- 패스워드
COMMENT ON COLUMN "MY_SCHEMA"."members"."password" IS '패스워드';
-- 이메일
COMMENT ON COLUMN "MY_SCHEMA"."members"."email" IS '이메일';
-- 핸드폰번호
COMMENT ON COLUMN "MY_SCHEMA"."members"."phone_number" IS '핸드폰번호';
-- 회원설명
COMMENT ON COLUMN "MY_SCHEMA"."members"."mem_content" IS '회원설명';
-- 가입일시
COMMENT ON COLUMN "MY_SCHEMA"."members"."join_at" IS '가입일시';
-- 승인상태
COMMENT ON COLUMN "MY_SCHEMA"."members"."confirm_status" IS '승인상태';
-- 승인일시
COMMENT ON COLUMN "MY_SCHEMA"."members"."confirm_at" IS '승인일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."members"."update_at" IS '수정일시';
-- 탈퇴일시
COMMENT ON COLUMN "MY_SCHEMA"."members"."out_at" IS '탈퇴일시';
-- 회원 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_members" IS '회원 기본키';
-- 회원 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."members"."PK_members" IS '회원 기본키';
-- 게시판
CREATE TABLE "MY_SCHEMA"."board" (
"COL" <데이터 타입 없음> NULL, -- 게시판id
"COL2" <데이터 타입 없음> NULL, -- 새 컬럼
"COL3" <데이터 타입 없음> NULL -- 새 컬럼2
);
-- 게시판
COMMENT ON TABLE "MY_SCHEMA"."board" IS '게시판';
-- 게시판id
COMMENT ON COLUMN "MY_SCHEMA"."board"."COL" IS '게시판id';
-- 새 컬럼
COMMENT ON COLUMN "MY_SCHEMA"."board"."COL2" IS '새 컬럼';
-- 새 컬럼2
COMMENT ON COLUMN "MY_SCHEMA"."board"."COL3" IS '새 컬럼2';
-- 지역명
CREATE TABLE "MY_SCHEMA"."TABLE" (
"COL" INTEGER NOT NULL, -- 지역id
"city_code" INTEGER NULL, -- 시도코드
"city_name" VARCHAR(50) NULL, -- 시도명칭
"area_code" INTEGER NULL, -- 시군구코드
"area_name" VARCHAR(50) NULL, -- 시군구명칭
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 지역명 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_TABLE"
ON "MY_SCHEMA"."TABLE" ( -- 지역명
"COL" ASC -- 지역id
);
-- 지역명
ALTER TABLE "MY_SCHEMA"."TABLE"
ADD
CONSTRAINT "PK_TABLE" -- 지역명 기본키
PRIMARY KEY (
"COL" -- 지역id
);
-- 지역명
COMMENT ON TABLE "MY_SCHEMA"."TABLE" IS '지역명';
-- 지역id
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."COL" IS '지역id';
-- 시도코드
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."city_code" IS '시도코드';
-- 시도명칭
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."city_name" IS '시도명칭';
-- 시군구코드
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."area_code" IS '시군구코드';
-- 시군구명칭
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."area_name" IS '시군구명칭';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."TABLE"."delete_at" IS '삭제일시';
-- 지역명 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_TABLE" IS '지역명 기본키';
-- 지역명 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."TABLE"."PK_TABLE" IS '지역명 기본키';
-- 탈퇴회원
CREATE TABLE "MY_SCHEMA"."out_member" (
"mem_id" INTEGER NOT NULL, -- 회원ID
"mem_knd" VARCHAR(4) NULL, -- 회원종류
"mem_name" VARCHAR(50) NULL, -- 이름
"login" VARCHAR(255) NULL, -- 로그인ID
"password" VARCHAR(255) NULL, -- 패스워드
"email" VARCHAR(40) NULL, -- 이메일
"phone_number" VARCHAR(30) NULL, -- 핸드폰번호
"join_at" DATE NULL, -- 가입일시
"out_content" TEXT NULL, -- 탈퇴내용
"out_at" DATE NULL -- 탈퇴일시
);
-- 탈퇴회원 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_out_member"
ON "MY_SCHEMA"."out_member" ( -- 탈퇴회원
"mem_id" ASC -- 회원ID
);
-- 탈퇴회원
ALTER TABLE "MY_SCHEMA"."out_member"
ADD
CONSTRAINT "PK_out_member" -- 탈퇴회원 기본키
PRIMARY KEY (
"mem_id" -- 회원ID
);
-- 탈퇴회원
COMMENT ON TABLE "MY_SCHEMA"."out_member" IS '탈퇴회원';
-- 회원ID
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."mem_id" IS '회원ID';
-- 회원종류
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."mem_knd" IS '회원종류';
-- 이름
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."mem_name" IS '이름';
-- 로그인ID
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."login" IS '로그인ID';
-- 패스워드
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."password" IS '패스워드';
-- 이메일
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."email" IS '이메일';
-- 핸드폰번호
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."phone_number" IS '핸드폰번호';
-- 가입일시
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."join_at" IS '가입일시';
-- 탈퇴내용
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."out_content" IS '탈퇴내용';
-- 탈퇴일시
COMMENT ON COLUMN "MY_SCHEMA"."out_member"."out_at" IS '탈퇴일시';
-- 탈퇴회원 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_out_member" IS '탈퇴회원 기본키';
-- 탈퇴회원 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."out_member"."PK_out_member" IS '탈퇴회원 기본키';
-- 찜폴더
CREATE TABLE "MY_SCHEMA"."like_folder" (
"like_folder_id" INTEGER NOT NULL, -- 찜폴더ID
"like_folder_name" VARCHAR(50) NOT NULL, -- 찜폴더명
"order" INTEGER NULL, -- 순서
"mem_id" INTEGER NULL, -- 회원ID
"create_at" DATE NOT NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 찜폴더 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_like_folder"
ON "MY_SCHEMA"."like_folder" ( -- 찜폴더
"like_folder_id" ASC -- 찜폴더ID
);
-- 찜폴더
ALTER TABLE "MY_SCHEMA"."like_folder"
ADD
CONSTRAINT "PK_like_folder" -- 찜폴더 기본키
PRIMARY KEY (
"like_folder_id" -- 찜폴더ID
);
-- 찜폴더
COMMENT ON TABLE "MY_SCHEMA"."like_folder" IS '찜폴더';
-- 찜폴더ID
COMMENT ON COLUMN "MY_SCHEMA"."like_folder"."like_folder_id" IS '찜폴더ID';
-- 찜폴더명
COMMENT ON COLUMN "MY_SCHEMA"."like_folder"."like_folder_name" IS '찜폴더명';
-- 순서
COMMENT ON COLUMN "MY_SCHEMA"."like_folder"."order" IS '순서';
-- 회원ID
COMMENT ON COLUMN "MY_SCHEMA"."like_folder"."mem_id" IS '회원ID';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."like_folder"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."like_folder"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."like_folder"."delete_at" IS '삭제일시';
-- 찜폴더 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_like_folder" IS '찜폴더 기본키';
-- 찜폴더 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."like_folder"."PK_like_folder" IS '찜폴더 기본키';
-- 상품
CREATE TABLE "MY_SCHEMA"."product" (
"product_id" INTEGER NOT NULL, -- 상품ID
"product_kind" VARCHAR(4) NULL, -- 상품유형
"product_name" VARCHAR(50) NULL, -- 상품명
"product_explain" VARCHAR(255) NULL, -- 상품설명
"product_content" TEXT NULL, -- 상품내용
"cancel_agree_dt" DATE NULL, -- 취소가능일
"possible_co" INTEGER NULL, -- 가능인원
"city_id" INTEGER NULL, -- 도시ID
"zip" INTEGER NULL, -- 우편번호
"address" VARCHAR(255) NULL, -- 기본주소
"address2" <데이터 타입 없음> NULL, -- 상세주소
"mem_id" INTEGER NULL, -- 등록자id
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 상품 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_product"
ON "MY_SCHEMA"."product" ( -- 상품
"product_id" ASC -- 상품ID
);
-- 상품
ALTER TABLE "MY_SCHEMA"."product"
ADD
CONSTRAINT "PK_product" -- 상품 기본키
PRIMARY KEY (
"product_id" -- 상품ID
);
-- 상품
COMMENT ON TABLE "MY_SCHEMA"."product" IS '상품';
-- 상품ID
COMMENT ON COLUMN "MY_SCHEMA"."product"."product_id" IS '상품ID';
-- 상품유형
COMMENT ON COLUMN "MY_SCHEMA"."product"."product_kind" IS '상품유형';
-- 상품명
COMMENT ON COLUMN "MY_SCHEMA"."product"."product_name" IS '상품명';
-- 상품설명
COMMENT ON COLUMN "MY_SCHEMA"."product"."product_explain" IS '상품설명';
-- 상품내용
COMMENT ON COLUMN "MY_SCHEMA"."product"."product_content" IS '상품내용';
-- 취소가능일
COMMENT ON COLUMN "MY_SCHEMA"."product"."cancel_agree_dt" IS '취소가능일';
-- 가능인원
COMMENT ON COLUMN "MY_SCHEMA"."product"."possible_co" IS '가능인원';
-- 도시ID
COMMENT ON COLUMN "MY_SCHEMA"."product"."city_id" IS '도시ID';
-- 우편번호
COMMENT ON COLUMN "MY_SCHEMA"."product"."zip" IS '우편번호';
-- 기본주소
COMMENT ON COLUMN "MY_SCHEMA"."product"."address" IS '기본주소';
-- 상세주소
COMMENT ON COLUMN "MY_SCHEMA"."product"."address2" IS '상세주소';
-- 등록자id
COMMENT ON COLUMN "MY_SCHEMA"."product"."mem_id" IS '등록자id';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."product"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."product"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."product"."delete_at" IS '삭제일시';
-- 상품 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_product" IS '상품 기본키';
-- 상품 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."product"."PK_product" IS '상품 기본키';
-- 시설
CREATE TABLE "MY_SCHEMA"."facilities" (
"facility_id" INTEGER NOT NULL, -- 시설ID
"parent_facility_id" INTEGER NOT NULL, -- 부모시설ID
"facility_name" VARCHAR(50) NULL, -- 시설명
"facility_explain" TEXT NULL, -- 시설설명
"facility_image" LONG VARGRAPHIC NULL, -- 시설이미지
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 시설 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_facilities"
ON "MY_SCHEMA"."facilities" ( -- 시설
"facility_id" ASC -- 시설ID
);
-- 시설
ALTER TABLE "MY_SCHEMA"."facilities"
ADD
CONSTRAINT "PK_facilities" -- 시설 기본키
PRIMARY KEY (
"facility_id" -- 시설ID
);
-- 시설
COMMENT ON TABLE "MY_SCHEMA"."facilities" IS '시설';
-- 시설ID
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."facility_id" IS '시설ID';
-- 부모시설ID
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."parent_facility_id" IS '부모시설ID';
-- 시설명
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."facility_name" IS '시설명';
-- 시설설명
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."facility_explain" IS '시설설명';
-- 시설이미지
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."facility_image" IS '시설이미지';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."facilities"."delete_at" IS '삭제일시';
-- 시설 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_facilities" IS '시설 기본키';
-- 시설 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."facilities"."PK_facilities" IS '시설 기본키';
-- 상품시설
CREATE TABLE "MY_SCHEMA"."add_facilities" (
"product_id" INTEGER NOT NULL, -- 상품ID
"facility_id" INTEGER NOT NULL -- 시설ID
);
-- 상품시설
COMMENT ON TABLE "MY_SCHEMA"."add_facilities" IS '상품시설';
-- 상품ID
COMMENT ON COLUMN "MY_SCHEMA"."add_facilities"."product_id" IS '상품ID';
-- 시설ID
COMMENT ON COLUMN "MY_SCHEMA"."add_facilities"."facility_id" IS '시설ID';
-- 상품이미지
CREATE TABLE "MY_SCHEMA"."product_image" (
"image_id" INTEGER NOT NULL, -- 이미지ID
"product_id" INTEGER NOT NULL, -- 상품ID
"image_kind" VARCHAR(4) NULL, -- 이미지종류
"image_link" LONG VARGRAPHIC NULL, -- 이미지링크
"mem_id" INTEGER NULL, -- 등록자id
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 상품이미지 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_product_image"
ON "MY_SCHEMA"."product_image" ( -- 상품이미지
"image_id" ASC -- 이미지ID
);
-- 상품이미지
ALTER TABLE "MY_SCHEMA"."product_image"
ADD
CONSTRAINT "PK_product_image" -- 상품이미지 기본키
PRIMARY KEY (
"image_id" -- 이미지ID
);
-- 상품이미지
COMMENT ON TABLE "MY_SCHEMA"."product_image" IS '상품이미지';
-- 이미지ID
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."image_id" IS '이미지ID';
-- 상품ID
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."product_id" IS '상품ID';
-- 이미지종류
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."image_kind" IS '이미지종류';
-- 이미지링크
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."image_link" IS '이미지링크';
-- 등록자id
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."mem_id" IS '등록자id';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."product_image"."delete_at" IS '삭제일시';
-- 상품이미지 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_product_image" IS '상품이미지 기본키';
-- 상품이미지 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."product_image"."PK_product_image" IS '상품이미지 기본키';
-- 스케줄
CREATE TABLE "MY_SCHEMA"."schedule" (
"COL" INTEGER NOT NULL, -- 스케줄ID
"product_id" INTEGER NOT NULL, -- 상품ID
"year" INTEGER NULL, -- 연
"month" INTEGER NULL, -- 월
"day" INTEGER NULL, -- 일
"status" VARCHAR(4) NULL, -- 상태
"clean_fee" INTEGER NULL, -- 청소료
"vat" INTEGER NULL, -- 부가세
"etc_vat" INTEGER NULL, -- 기타수수료
"price" INTEGER NULL, -- 가격
"mem_id" INTEGER NULL, -- 등록자id
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 스케줄 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_schedule"
ON "MY_SCHEMA"."schedule" ( -- 스케줄
"COL" ASC -- 스케줄ID
);
-- 스케줄
ALTER TABLE "MY_SCHEMA"."schedule"
ADD
CONSTRAINT "PK_schedule" -- 스케줄 기본키
PRIMARY KEY (
"COL" -- 스케줄ID
);
-- 스케줄
COMMENT ON TABLE "MY_SCHEMA"."schedule" IS '스케줄';
-- 스케줄ID
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."COL" IS '스케줄ID';
-- 상품ID
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."product_id" IS '상품ID';
-- 연
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."year" IS '연';
-- 월
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."month" IS '월';
-- 일
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."day" IS '일';
-- 상태
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."status" IS '상태';
-- 청소료
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."clean_fee" IS '청소료';
-- 부가세
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."vat" IS '부가세';
-- 기타수수료
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."etc_vat" IS '기타수수료';
-- 가격
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."price" IS '가격';
-- 등록자id
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."mem_id" IS '등록자id';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."schedule"."delete_at" IS '삭제일시';
-- 스케줄 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_schedule" IS '스케줄 기본키';
-- 스케줄 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."schedule"."PK_schedule" IS '스케줄 기본키';
-- 찜상품
CREATE TABLE "MY_SCHEMA"."like_product" (
"like_folder_id" INTEGER NOT NULL, -- 찜폴더ID
"product_id" INTEGER NOT NULL, -- 상품ID
"create_at" DATE NOT NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 찜상품
COMMENT ON TABLE "MY_SCHEMA"."like_product" IS '찜상품';
-- 찜폴더ID
COMMENT ON COLUMN "MY_SCHEMA"."like_product"."like_folder_id" IS '찜폴더ID';
-- 상품ID
COMMENT ON COLUMN "MY_SCHEMA"."like_product"."product_id" IS '상품ID';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."like_product"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."like_product"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."like_product"."delete_at" IS '삭제일시';
-- 나라
CREATE TABLE "MY_SCHEMA"."country" (
"country_id" INTEGER NOT NULL, -- 나라ID
"country_code" INTEGER NULL, -- 나라코드
"country_name" VARCHAR(50) NULL, -- 나라명
"mem_id" INTEGER NULL, -- 등록자id
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 나라 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_country"
ON "MY_SCHEMA"."country" ( -- 나라
"country_id" ASC -- 나라ID
);
-- 나라
ALTER TABLE "MY_SCHEMA"."country"
ADD
CONSTRAINT "PK_country" -- 나라 기본키
PRIMARY KEY (
"country_id" -- 나라ID
);
-- 나라
COMMENT ON TABLE "MY_SCHEMA"."country" IS '나라';
-- 나라ID
COMMENT ON COLUMN "MY_SCHEMA"."country"."country_id" IS '나라ID';
-- 나라코드
COMMENT ON COLUMN "MY_SCHEMA"."country"."country_code" IS '나라코드';
-- 나라명
COMMENT ON COLUMN "MY_SCHEMA"."country"."country_name" IS '나라명';
-- 등록자id
COMMENT ON COLUMN "MY_SCHEMA"."country"."mem_id" IS '등록자id';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."country"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."country"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."country"."delete_at" IS '삭제일시';
-- 나라 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_country" IS '나라 기본키';
-- 나라 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."country"."PK_country" IS '나라 기본키';
-- 도시
CREATE TABLE "MY_SCHEMA"."city" (
"city_id" INTEGER NOT NULL, -- 도시ID
"city_code" INTEGER NULL, -- 도시코드
"city_name" VARCHAR(50) NULL, -- 도시명
"country_id" INTEGER NOT NULL, -- 나라ID
"mem_id" INTEGER NULL, -- 등록자id
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 도시 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_city"
ON "MY_SCHEMA"."city" ( -- 도시
"city_id" ASC -- 도시ID
);
-- 도시
ALTER TABLE "MY_SCHEMA"."city"
ADD
CONSTRAINT "PK_city" -- 도시 기본키
PRIMARY KEY (
"city_id" -- 도시ID
);
-- 도시
COMMENT ON TABLE "MY_SCHEMA"."city" IS '도시';
-- 도시ID
COMMENT ON COLUMN "MY_SCHEMA"."city"."city_id" IS '도시ID';
-- 도시코드
COMMENT ON COLUMN "MY_SCHEMA"."city"."city_code" IS '도시코드';
-- 도시명
COMMENT ON COLUMN "MY_SCHEMA"."city"."city_name" IS '도시명';
-- 나라ID
COMMENT ON COLUMN "MY_SCHEMA"."city"."country_id" IS '나라ID';
-- 등록자id
COMMENT ON COLUMN "MY_SCHEMA"."city"."mem_id" IS '등록자id';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."city"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."city"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."city"."delete_at" IS '삭제일시';
-- 도시 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_city" IS '도시 기본키';
-- 도시 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."city"."PK_city" IS '도시 기본키';
-- 예약
CREATE TABLE "MY_SCHEMA"."reservation" (
"reservation_id" INTEGER NOT NULL, -- 예약ID
"reservation_code" VARCHAR(255) NULL, -- 예약코드
"reservation_status" VARCHAR(4) NULL, -- 예약상태
"reservation_co" INTEGER NULL, -- 예약인원
"reservation_request" VARCHAR(255) NULL, -- 요청사항
"clean_fee" INTEGER NULL, -- 청소료
"vat" INTEGER NULL, -- 부가세
"etc_fee" INTEGER NULL, -- 기타수수료
"total_price" INTEGER NULL, -- 총금액
"start_at_id" INTEGER NOT NULL, -- 시작스케줄ID
"end_at_id" INTEGER NOT NULL, -- 종료스케줄ID
"mem_id" INTEGER NOT NULL, -- 예약회원ID
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 예약 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_reservation"
ON "MY_SCHEMA"."reservation" ( -- 예약
"reservation_id" ASC -- 예약ID
);
-- 예약
ALTER TABLE "MY_SCHEMA"."reservation"
ADD
CONSTRAINT "PK_reservation" -- 예약 기본키
PRIMARY KEY (
"reservation_id" -- 예약ID
);
-- 예약
COMMENT ON TABLE "MY_SCHEMA"."reservation" IS '예약';
-- 예약ID
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."reservation_id" IS '예약ID';
-- 예약코드
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."reservation_code" IS '예약코드';
-- 예약상태
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."reservation_status" IS '예약상태';
-- 예약인원
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."reservation_co" IS '예약인원';
-- 요청사항
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."reservation_request" IS '요청사항';
-- 청소료
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."clean_fee" IS '청소료';
-- 부가세
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."vat" IS '부가세';
-- 기타수수료
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."etc_fee" IS '기타수수료';
-- 총금액
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."total_price" IS '총금액';
-- 시작스케줄ID
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."start_at_id" IS '시작스케줄ID';
-- 종료스케줄ID
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."end_at_id" IS '종료스케줄ID';
-- 예약회원ID
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."mem_id" IS '예약회원ID';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."reservation"."delete_at" IS '삭제일시';
-- 예약 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_reservation" IS '예약 기본키';
-- 예약 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."reservation"."PK_reservation" IS '예약 기본키';
-- 결제
CREATE TABLE "MY_SCHEMA"."payment" (
"payment_id" INTEGER NOT NULL, -- 결제ID
"reservation_id" INTEGER NOT NULL, -- 예약ID
"payment_status" VARCHAR(4) NULL, -- 결제상태
"bank_kind" VARCHAR(4) NULL, -- 은행종류
"deposit_name" VARCHAR(50) NULL, -- 임금자명
"account_number" INTEGER NULL, -- 계좌번호
"request_price" INTEGER NULL, -- 요청금액
"deposit_price" INTEGER NULL, -- 입금금액
"cancel_price" INTEGER NULL, -- 취소금액
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 결제 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_payment"
ON "MY_SCHEMA"."payment" ( -- 결제
"payment_id" ASC -- 결제ID
);
-- 결제
ALTER TABLE "MY_SCHEMA"."payment"
ADD
CONSTRAINT "PK_payment" -- 결제 기본키
PRIMARY KEY (
"payment_id" -- 결제ID
);
-- 결제
COMMENT ON TABLE "MY_SCHEMA"."payment" IS '결제';
-- 결제ID
COMMENT ON COLUMN "MY_SCHEMA"."payment"."payment_id" IS '결제ID';
-- 예약ID
COMMENT ON COLUMN "MY_SCHEMA"."payment"."reservation_id" IS '예약ID';
-- 결제상태
COMMENT ON COLUMN "MY_SCHEMA"."payment"."payment_status" IS '결제상태';
-- 은행종류
COMMENT ON COLUMN "MY_SCHEMA"."payment"."bank_kind" IS '은행종류';
-- 임금자명
COMMENT ON COLUMN "MY_SCHEMA"."payment"."deposit_name" IS '임금자명';
-- 계좌번호
COMMENT ON COLUMN "MY_SCHEMA"."payment"."account_number" IS '계좌번호';
-- 요청금액
COMMENT ON COLUMN "MY_SCHEMA"."payment"."request_price" IS '요청금액';
-- 입금금액
COMMENT ON COLUMN "MY_SCHEMA"."payment"."deposit_price" IS '입금금액';
-- 취소금액
COMMENT ON COLUMN "MY_SCHEMA"."payment"."cancel_price" IS '취소금액';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."payment"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."payment"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."payment"."delete_at" IS '삭제일시';
-- 결제 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_payment" IS '결제 기본키';
-- 결제 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."payment"."PK_payment" IS '결제 기본키';
-- 리뷰
CREATE TABLE "MY_SCHEMA"."review" (
"review_id" INTEGER NOT NULL, -- 리뷰ID
"reservation_id" INTEGER NOT NULL, -- 예약ID
"product_id" INTEGER NOT NULL, -- 상품ID
"review_title" VARCHAR(255) NULL, -- 리뷰제목
"review_content" TEXT NULL, -- 리뷰내용
"grage" FLOAT NULL, -- 평점
"write_id" INTEGER NULL, -- 등록자id
"write_at" DATE NULL, -- 작성일시
"update_at" DATE NULL -- 수정일시
);
-- 리뷰 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_review"
ON "MY_SCHEMA"."review" ( -- 리뷰
"review_id" ASC -- 리뷰ID
);
-- 리뷰
ALTER TABLE "MY_SCHEMA"."review"
ADD
CONSTRAINT "PK_review" -- 리뷰 기본키
PRIMARY KEY (
"review_id" -- 리뷰ID
);
-- 리뷰
COMMENT ON TABLE "MY_SCHEMA"."review" IS '리뷰';
-- 리뷰ID
COMMENT ON COLUMN "MY_SCHEMA"."review"."review_id" IS '리뷰ID';
-- 예약ID
COMMENT ON COLUMN "MY_SCHEMA"."review"."reservation_id" IS '예약ID';
-- 상품ID
COMMENT ON COLUMN "MY_SCHEMA"."review"."product_id" IS '상품ID';
-- 리뷰제목
COMMENT ON COLUMN "MY_SCHEMA"."review"."review_title" IS '리뷰제목';
-- 리뷰내용
COMMENT ON COLUMN "MY_SCHEMA"."review"."review_content" IS '리뷰내용';
-- 평점
COMMENT ON COLUMN "MY_SCHEMA"."review"."grage" IS '평점';
-- 등록자id
COMMENT ON COLUMN "MY_SCHEMA"."review"."write_id" IS '등록자id';
-- 작성일시
COMMENT ON COLUMN "MY_SCHEMA"."review"."write_at" IS '작성일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."review"."update_at" IS '수정일시';
-- 리뷰 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_review" IS '리뷰 기본키';
-- 리뷰 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."review"."PK_review" IS '리뷰 기본키';
-- 댓글
CREATE TABLE "MY_SCHEMA"."reply" (
"reply_id" <데이터 타입 없음> NOT NULL, -- 댓글ID
"reply_content" <데이터 타입 없음> NULL, -- 댓글내용
"review_id" INTEGER NULL, -- 리뷰ID
"mem_id" INTEGER NULL, -- 작성자ID
"write_at" <데이터 타입 없음> NULL, -- 작성일시
"update_at" <데이터 타입 없음> NULL -- 수정일시
);
-- 댓글 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_reply"
ON "MY_SCHEMA"."reply" ( -- 댓글
"reply_id" ASC -- 댓글ID
);
-- 댓글
ALTER TABLE "MY_SCHEMA"."reply"
ADD
CONSTRAINT "PK_reply" -- 댓글 기본키
PRIMARY KEY (
"reply_id" -- 댓글ID
);
-- 댓글
COMMENT ON TABLE "MY_SCHEMA"."reply" IS '댓글';
-- 댓글ID
COMMENT ON COLUMN "MY_SCHEMA"."reply"."reply_id" IS '댓글ID';
-- 댓글내용
COMMENT ON COLUMN "MY_SCHEMA"."reply"."reply_content" IS '댓글내용';
-- 리뷰ID
COMMENT ON COLUMN "MY_SCHEMA"."reply"."review_id" IS '리뷰ID';
-- 작성자ID
COMMENT ON COLUMN "MY_SCHEMA"."reply"."mem_id" IS '작성자ID';
-- 작성일시
COMMENT ON COLUMN "MY_SCHEMA"."reply"."write_at" IS '작성일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."reply"."update_at" IS '수정일시';
-- 댓글 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_reply" IS '댓글 기본키';
-- 댓글 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."reply"."PK_reply" IS '댓글 기본키';
-- 리뷰이미지
CREATE TABLE "MY_SCHEMA"."review_image" (
"review_image_id" INTEGER NOT NULL, -- 리뷰이미지ID
"review_id" INTEGER NOT NULL, -- 리뷰ID
"review_image_kind" VARCHAR(4) NULL, -- 이미지종류
"review_image_link" LONG VARGRAPHIC NULL, -- 이미지링크
"create_at" DATE NULL, -- 등록일시
"update_at" DATE NULL, -- 수정일시
"delete_at" DATE NULL -- 삭제일시
);
-- 리뷰이미지 기본키
CREATE UNIQUE INDEX "MY_SCHEMA"."PK_review_image"
ON "MY_SCHEMA"."review_image" ( -- 리뷰이미지
"review_image_id" ASC -- 리뷰이미지ID
);
-- 리뷰이미지
ALTER TABLE "MY_SCHEMA"."review_image"
ADD
CONSTRAINT "PK_review_image" -- 리뷰이미지 기본키
PRIMARY KEY (
"review_image_id" -- 리뷰이미지ID
);
-- 리뷰이미지
COMMENT ON TABLE "MY_SCHEMA"."review_image" IS '리뷰이미지';
-- 리뷰이미지ID
COMMENT ON COLUMN "MY_SCHEMA"."review_image"."review_image_id" IS '리뷰이미지ID';
-- 리뷰ID
COMMENT ON COLUMN "MY_SCHEMA"."review_image"."review_id" IS '리뷰ID';
-- 이미지종류
COMMENT ON COLUMN "MY_SCHEMA"."review_image"."review_image_kind" IS '이미지종류';
-- 이미지링크
COMMENT ON COLUMN "MY_SCHEMA"."review_image"."review_image_link" IS '이미지링크';
-- 등록일시
COMMENT ON COLUMN "MY_SCHEMA"."review_image"."create_at" IS '등록일시';
-- 수정일시
COMMENT ON COLUMN "MY_SCHEMA"."review_image"."update_at" IS '수정일시';
-- 삭제일시
COMMENT ON COLUMN "MY_SCHEMA"."review_image"."delete_at" IS '삭제일시';
-- 리뷰이미지 기본키
COMMENT ON INDEX "MY_SCHEMA"."PK_review_image" IS '리뷰이미지 기본키';
-- 리뷰이미지 기본키
COMMENT ON CONSTRAINT "MY_SCHEMA"."review_image"."PK_review_image" IS '리뷰이미지 기본키';
-- 찜폴더
ALTER TABLE "MY_SCHEMA"."like_folder"
ADD
CONSTRAINT "FK_members_TO_like_folder" -- 회원 -> 찜폴더
FOREIGN KEY (
"mem_id" -- 회원ID
)
REFERENCES "MY_SCHEMA"."members" ( -- 회원
"mem_id" -- 회원ID
);
-- 회원 -> 찜폴더
COMMENT ON CONSTRAINT "MY_SCHEMA"."like_folder"."FK_members_TO_like_folder" IS '회원 -> 찜폴더';
-- 상품
ALTER TABLE "MY_SCHEMA"."product"
ADD
CONSTRAINT "FK_members_TO_product" -- 회원 -> 상품
FOREIGN KEY (
"mem_id" -- 등록자id
)
REFERENCES "MY_SCHEMA"."members" ( -- 회원
"mem_id" -- 회원ID
);
-- 회원 -> 상품
COMMENT ON CONSTRAINT "MY_SCHEMA"."product"."FK_members_TO_product" IS '회원 -> 상품';
-- 상품
ALTER TABLE "MY_SCHEMA"."product"
ADD
CONSTRAINT "FK_city_TO_product" -- 도시 -> 상품
FOREIGN KEY (
"city_id" -- 도시ID
)
REFERENCES "MY_SCHEMA"."city" ( -- 도시
"city_id" -- 도시ID
);
-- 도시 -> 상품
COMMENT ON CONSTRAINT "MY_SCHEMA"."product"."FK_city_TO_product" IS '도시 -> 상품';
-- 시설
ALTER TABLE "MY_SCHEMA"."facilities"
ADD
CONSTRAINT "FK_facilities_TO_facilities" -- 시설 -> 시설
FOREIGN KEY (
"parent_facility_id" -- 부모시설ID
)
REFERENCES "MY_SCHEMA"."facilities" ( -- 시설
"facility_id" -- 시설ID
);
-- 시설 -> 시설
COMMENT ON CONSTRAINT "MY_SCHEMA"."facilities"."FK_facilities_TO_facilities" IS '시설 -> 시설';
-- 상품시설
ALTER TABLE "MY_SCHEMA"."add_facilities"
ADD
CONSTRAINT "FK_facilities_TO_add_facilities" -- 시설 -> 상품시설
FOREIGN KEY (
"facility_id" -- 시설ID
)
REFERENCES "MY_SCHEMA"."facilities" ( -- 시설
"facility_id" -- 시설ID
);
-- 시설 -> 상품시설
COMMENT ON CONSTRAINT "MY_SCHEMA"."add_facilities"."FK_facilities_TO_add_facilities" IS '시설 -> 상품시설';
-- 상품시설
ALTER TABLE "MY_SCHEMA"."add_facilities"
ADD
CONSTRAINT "FK_product_TO_add_facilities" -- 상품 -> 상품시설
FOREIGN KEY (
"product_id" -- 상품ID
)
REFERENCES "MY_SCHEMA"."product" ( -- 상품
"product_id" -- 상품ID
);
-- 상품 -> 상품시설
COMMENT ON CONSTRAINT "MY_SCHEMA"."add_facilities"."FK_product_TO_add_facilities" IS '상품 -> 상품시설';
-- 상품이미지
ALTER TABLE "MY_SCHEMA"."product_image"
ADD
CONSTRAINT "FK_product_TO_product_image" -- 상품 -> 상품이미지
FOREIGN KEY (
"product_id" -- 상품ID
)
REFERENCES "MY_SCHEMA"."product" ( -- 상품
"product_id" -- 상품ID
);
-- 상품 -> 상품이미지
COMMENT ON CONSTRAINT "MY_SCHEMA"."product_image"."FK_product_TO_product_image" IS '상품 -> 상품이미지';
-- 스케줄
ALTER TABLE "MY_SCHEMA"."schedule"
ADD
CONSTRAINT "FK_product_TO_schedule" -- 상품 -> 스케줄
FOREIGN KEY (
"product_id" -- 상품ID
)
REFERENCES "MY_SCHEMA"."product" ( -- 상품
"product_id" -- 상품ID
);
-- 상품 -> 스케줄
COMMENT ON CONSTRAINT "MY_SCHEMA"."schedule"."FK_product_TO_schedule" IS '상품 -> 스케줄';
-- 찜상품
ALTER TABLE "MY_SCHEMA"."like_product"
ADD
CONSTRAINT "FK_like_folder_TO_like_product" -- 찜폴더 -> 찜상품
FOREIGN KEY (
"like_folder_id" -- 찜폴더ID
)
REFERENCES "MY_SCHEMA"."like_folder" ( -- 찜폴더
"like_folder_id" -- 찜폴더ID
);
-- 찜폴더 -> 찜상품
COMMENT ON CONSTRAINT "MY_SCHEMA"."like_product"."FK_like_folder_TO_like_product" IS '찜폴더 -> 찜상품';
-- 찜상품
ALTER TABLE "MY_SCHEMA"."like_product"
ADD
CONSTRAINT "FK_product_TO_like_product" -- 상품 -> 찜상품
FOREIGN KEY (
"product_id" -- 상품ID
)
REFERENCES "MY_SCHEMA"."product" ( -- 상품
"product_id" -- 상품ID
);
-- 상품 -> 찜상품
COMMENT ON CONSTRAINT "MY_SCHEMA"."like_product"."FK_product_TO_like_product" IS '상품 -> 찜상품';
-- 도시
ALTER TABLE "MY_SCHEMA"."city"
ADD
CONSTRAINT "FK_country_TO_city" -- 나라 -> 도시
FOREIGN KEY (
"country_id" -- 나라ID
)
REFERENCES "MY_SCHEMA"."country" ( -- 나라
"country_id" -- 나라ID
);
-- 나라 -> 도시
COMMENT ON CONSTRAINT "MY_SCHEMA"."city"."FK_country_TO_city" IS '나라 -> 도시';
-- 예약
ALTER TABLE "MY_SCHEMA"."reservation"
ADD
CONSTRAINT "FK_schedule_TO_reservation" -- 스케줄 -> 예약
FOREIGN KEY (
"start_at_id" -- 시작스케줄ID
)
REFERENCES "MY_SCHEMA"."schedule" ( -- 스케줄
"COL" -- 스케줄ID
);
-- 스케줄 -> 예약
COMMENT ON CONSTRAINT "MY_SCHEMA"."reservation"."FK_schedule_TO_reservation" IS '스케줄 -> 예약';
-- 예약
ALTER TABLE "MY_SCHEMA"."reservation"
ADD
CONSTRAINT "FK_schedule_TO_reservation2" -- 스케줄 -> 예약2
FOREIGN KEY (
"end_at_id" -- 종료스케줄ID
)
REFERENCES "MY_SCHEMA"."schedule" ( -- 스케줄
"COL" -- 스케줄ID
);
-- 스케줄 -> 예약2
COMMENT ON CONSTRAINT "MY_SCHEMA"."reservation"."FK_schedule_TO_reservation2" IS '스케줄 -> 예약2';
-- 예약
ALTER TABLE "MY_SCHEMA"."reservation"
ADD
CONSTRAINT "FK_members_TO_reservation" -- 회원 -> 예약
FOREIGN KEY (
"mem_id" -- 예약회원ID
)
REFERENCES "MY_SCHEMA"."members" ( -- 회원
"mem_id" -- 회원ID
);
-- 회원 -> 예약
COMMENT ON CONSTRAINT "MY_SCHEMA"."reservation"."FK_members_TO_reservation" IS '회원 -> 예약';
-- 결제
ALTER TABLE "MY_SCHEMA"."payment"
ADD
CONSTRAINT "FK_reservation_TO_payment" -- 예약 -> 결제
FOREIGN KEY (
"reservation_id" -- 예약ID
)
REFERENCES "MY_SCHEMA"."reservation" ( -- 예약
"reservation_id" -- 예약ID
);
-- 예약 -> 결제
COMMENT ON CONSTRAINT "MY_SCHEMA"."payment"."FK_reservation_TO_payment" IS '예약 -> 결제';
-- 리뷰
ALTER TABLE "MY_SCHEMA"."review"
ADD
CONSTRAINT "FK_reservation_TO_review" -- 예약 -> 리뷰
FOREIGN KEY (
"reservation_id" -- 예약ID
)
REFERENCES "MY_SCHEMA"."reservation" ( -- 예약
"reservation_id" -- 예약ID
);
-- 예약 -> 리뷰
COMMENT ON CONSTRAINT "MY_SCHEMA"."review"."FK_reservation_TO_review" IS '예약 -> 리뷰';
-- 리뷰
ALTER TABLE "MY_SCHEMA"."review"
ADD
CONSTRAINT "FK_product_TO_review" -- 상품 -> 리뷰
FOREIGN KEY (
"product_id" -- 상품ID
)
REFERENCES "MY_SCHEMA"."product" ( -- 상품
"product_id" -- 상품ID
);
-- 상품 -> 리뷰
COMMENT ON CONSTRAINT "MY_SCHEMA"."review"."FK_product_TO_review" IS '상품 -> 리뷰';
-- 댓글
ALTER TABLE "MY_SCHEMA"."reply"
ADD
CONSTRAINT "FK_review_TO_reply" -- 리뷰 -> 댓글
FOREIGN KEY (
"review_id" -- 리뷰ID
)
REFERENCES "MY_SCHEMA"."review" ( -- 리뷰
"review_id" -- 리뷰ID
);
-- 리뷰 -> 댓글
COMMENT ON CONSTRAINT "MY_SCHEMA"."reply"."FK_review_TO_reply" IS '리뷰 -> 댓글';
-- 댓글
ALTER TABLE "MY_SCHEMA"."reply"
ADD
CONSTRAINT "FK_members_TO_reply" -- 회원 -> 댓글
FOREIGN KEY (
"mem_id" -- 작성자ID
)
REFERENCES "MY_SCHEMA"."members" ( -- 회원
"mem_id" -- 회원ID
);
-- 회원 -> 댓글
COMMENT ON CONSTRAINT "MY_SCHEMA"."reply"."FK_members_TO_reply" IS '회원 -> 댓글';
-- 리뷰이미지
ALTER TABLE "MY_SCHEMA"."review_image"
ADD
CONSTRAINT "FK_review_TO_review_image" -- 리뷰 -> 리뷰이미지
FOREIGN KEY (
"review_id" -- 리뷰ID
)
REFERENCES "MY_SCHEMA"."review" ( -- 리뷰
"review_id" -- 리뷰ID
);
-- 리뷰 -> 리뷰이미지
COMMENT ON CONSTRAINT "MY_SCHEMA"."review_image"."FK_review_TO_review_image" IS '리뷰 -> 리뷰이미지';