Skip to content

Commit

Permalink
feat: DeliveryPolicy 테이블 설계와 Dummy 데이터 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ku-kim committed Apr 25, 2022
1 parent 1276077 commit 1157fca
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 28 deletions.
30 changes: 17 additions & 13 deletions BE/src/main/resources/db/data.sql
Expand Up @@ -2,20 +2,24 @@ INSERT INTO discount_policy (discount_rate, policy_name)
VALUES (10, '런칭특가'),
(20, '이벤트특가');

INSERT INTO product (discount_policy_id, product_name, description, original_price, meal_category,
INSERT INTO delivery_policy (delivery_info, delivery_charge, free_delivery_over_amount)
VALUES ('서울 경기 새벽 배송, 전국 택배 배송', 2500, 40000);

INSERT INTO product (discount_policy_id, delivery_policy_id, product_name, description,
original_price, meal_category,
best_category)
VALUES (1, '오리주물럭', '감칠맛 나는 매콤한 양념', 15800, 'main', 'meat'),
(2, '잡채', '탱글한 면과 맛깔진 고명이 가득', 12900, 'main', null),
(2, '소갈비찜', '촉촉하게 밴 양념이 일품', 28900, 'main', 'meat'),
(null, '간장 코다리조림', '쫀득한 코다리를 국내산 간장소스로맛있게 조렸어요', 14900, 'main', 'season'),
(2, '한돈 돼지 김치찌개', '김치찌개에는 역시 돼지고기', 9300, 'soup', 'meat'),
(2, '된장찌개', '특별하지 않아서 더 좋은 우리맛', 8800, 'soup', 'easy'),
(2, '미역오이냉국', '여름엔 시원한 냉국이 최고', 7800, 'soup', 'season'),
(null, '동태찌개', '겨울철 보양식으로 안성맞춤', 12000, 'soup', null),
(1, '새콤달콤 오징어무침', '국내산 오징어를 새콤달콤하게', 7500, 'side', 'kids'),
(2, '호두 멸치볶음', '잔명치와 호두가 만나 짭쪼름하지만 고소하게!', 5800, 'side', 'kids'),
(2, '한동 매콤 안심장조림', '촉촉하게 밴 양념이 일품', 6900, 'side', 'easy'),
(2, '야채 어묵볶음', '첨가물 없는 순수어묵과 야채와 만남', 4900, 'side', 'easy');
VALUES (1, 1, '오리주물럭', '감칠맛 나는 매콤한 양념', 15800, 'main', 'meat'),
(2, 1, '잡채', '탱글한 면과 맛깔진 고명이 가득', 12900, 'main', null),
(2, 1, '소갈비찜', '촉촉하게 밴 양념이 일품', 28900, 'main', 'meat'),
(null, 1, '간장 코다리조림', '쫀득한 코다리를 국내산 간장소스로맛있게 조렸어요', 14900, 'main', 'season'),
(2, 1, '한돈 돼지 김치찌개', '김치찌개에는 역시 돼지고기', 9300, 'soup', 'meat'),
(2, 1, '된장찌개', '특별하지 않아서 더 좋은 우리맛', 8800, 'soup', 'easy'),
(2, 1, '미역오이냉국', '여름엔 시원한 냉국이 최고', 7800, 'soup', 'season'),
(null, 1, '동태찌개', '겨울철 보양식으로 안성맞춤', 12000, 'soup', null),
(1, 1, '새콤달콤 오징어무침', '국내산 오징어를 새콤달콤하게', 7500, 'side', 'kids'),
(2, 1, '호두 멸치볶음', '잔명치와 호두가 만나 짭쪼름하지만 고소하게!', 5800, 'side', 'kids'),
(2, 1, '한동 매콤 안심장조림', '촉촉하게 밴 양념이 일품', 6900, 'side', 'easy'),
(2, 1, '야채 어묵볶음', '첨가물 없는 순수어묵과 야채와 만남', 4900, 'side', 'easy');


INSERT INTO product_image (product_id, image_url)
Expand Down
13 changes: 12 additions & 1 deletion BE/src/main/resources/db/schema.sql
@@ -1,6 +1,7 @@
drop table if exists product_image;
drop table if exists product;
drop table if exists discount_policy;
drop table if exists delivery_policy;

create table discount_policy
(
Expand All @@ -9,16 +10,26 @@ create table discount_policy
policy_name varchar(100) not null
);

create table delivery_policy
(
id bigint auto_increment primary key,
delivery_info varchar(100) not null,
delivery_charge int not null,
free_delivery_over_amount int not null
);

create table product
(
id bigint auto_increment primary key,
discount_policy_id bigint,
delivery_policy_id bigint,
product_name varchar(100) not null,
description varchar(1000),
original_price int not null,
meal_category varchar(100) not null,
best_category varchar(100),
foreign key (discount_policy_id) references discount_policy (id)
foreign key (discount_policy_id) references discount_policy (id),
foreign key (delivery_policy_id) references delivery_policy (id)
);

create table product_image
Expand Down
30 changes: 17 additions & 13 deletions BE/src/test/resources/testdb/data.sql
Expand Up @@ -2,20 +2,24 @@ INSERT INTO discount_policy (discount_rate, policy_name)
VALUES (10, '런칭특가'),
(20, '이벤트특가');

INSERT INTO product (discount_policy_id, product_name, description, original_price, meal_category,
INSERT INTO delivery_policy (delivery_info, delivery_charge, free_delivery_over_amount)
VALUES ('서울 경기 새벽 배송, 전국 택배 배송', 2500, 40000);

INSERT INTO product (discount_policy_id, delivery_policy_id, product_name, description,
original_price, meal_category,
best_category)
VALUES (1, '오리주물럭', '감칠맛 나는 매콤한 양념', 15800, 'main', 'meat'),
(2, '잡채', '탱글한 면과 맛깔진 고명이 가득', 12900, 'main', null),
(2, '소갈비찜', '촉촉하게 밴 양념이 일품', 28900, 'main', 'meat'),
(null, '간장 코다리조림', '쫀득한 코다리를 국내산 간장소스로맛있게 조렸어요', 14900, 'main', 'season'),
(2, '한돈 돼지 김치찌개', '김치찌개에는 역시 돼지고기', 9300, 'soup', 'meat'),
(2, '된장찌개', '특별하지 않아서 더 좋은 우리맛', 8800, 'soup', 'easy'),
(2, '미역오이냉국', '여름엔 시원한 냉국이 최고', 7800, 'soup', 'season'),
(null, '동태찌개', '겨울철 보양식으로 안성맞춤', 12000, 'soup', null),
(1, '새콤달콤 오징어무침', '국내산 오징어를 새콤달콤하게', 7500, 'side', 'kids'),
(2, '호두 멸치볶음', '잔명치와 호두가 만나 짭쪼름하지만 고소하게!', 5800, 'side', 'kids'),
(2, '한동 매콤 안심장조림', '촉촉하게 밴 양념이 일품', 6900, 'side', 'easy'),
(2, '야채 어묵볶음', '첨가물 없는 순수어묵과 야채와 만남', 4900, 'side', 'easy');
VALUES (1, 1, '오리주물럭', '감칠맛 나는 매콤한 양념', 15800, 'main', 'meat'),
(2, 1, '잡채', '탱글한 면과 맛깔진 고명이 가득', 12900, 'main', null),
(2, 1, '소갈비찜', '촉촉하게 밴 양념이 일품', 28900, 'main', 'meat'),
(null, 1, '간장 코다리조림', '쫀득한 코다리를 국내산 간장소스로맛있게 조렸어요', 14900, 'main', 'season'),
(2, 1, '한돈 돼지 김치찌개', '김치찌개에는 역시 돼지고기', 9300, 'soup', 'meat'),
(2, 1, '된장찌개', '특별하지 않아서 더 좋은 우리맛', 8800, 'soup', 'easy'),
(2, 1, '미역오이냉국', '여름엔 시원한 냉국이 최고', 7800, 'soup', 'season'),
(null, 1, '동태찌개', '겨울철 보양식으로 안성맞춤', 12000, 'soup', null),
(1, 1, '새콤달콤 오징어무침', '국내산 오징어를 새콤달콤하게', 7500, 'side', 'kids'),
(2, 1, '호두 멸치볶음', '잔명치와 호두가 만나 짭쪼름하지만 고소하게!', 5800, 'side', 'kids'),
(2, 1, '한동 매콤 안심장조림', '촉촉하게 밴 양념이 일품', 6900, 'side', 'easy'),
(2, 1, '야채 어묵볶음', '첨가물 없는 순수어묵과 야채와 만남', 4900, 'side', 'easy');


INSERT INTO product_image (product_id, image_url)
Expand Down
13 changes: 12 additions & 1 deletion BE/src/test/resources/testdb/schema.sql
@@ -1,6 +1,7 @@
drop table if exists product_image;
drop table if exists product;
drop table if exists discount_policy;
drop table if exists delivery_policy;

create table discount_policy
(
Expand All @@ -9,16 +10,26 @@ create table discount_policy
policy_name varchar(100) not null
);

create table delivery_policy
(
id bigint auto_increment primary key,
delivery_info varchar(100) not null,
delivery_charge int not null,
free_delivery_over_amount int not null
);

create table product
(
id bigint auto_increment primary key,
discount_policy_id bigint,
delivery_policy_id bigint,
product_name varchar(100) not null,
description varchar(1000),
original_price int not null,
meal_category varchar(100) not null,
best_category varchar(100),
foreign key (discount_policy_id) references discount_policy (id)
foreign key (discount_policy_id) references discount_policy (id),
foreign key (delivery_policy_id) references delivery_policy (id)
);

create table product_image
Expand Down

0 comments on commit 1157fca

Please sign in to comment.