Skip to content

Commit

Permalink
Merge pull request #66 from taco-official/KL-180/uuid-관련-문제-해결
Browse files Browse the repository at this point in the history
fix(KL-180): UUID related problem
  • Loading branch information
ohhamma authored Sep 30, 2024
2 parents e161d54 + ab28110 commit 86546a8
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/taco/klkl/domain/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Member {
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

@Column(unique = true, nullable = false, updatable = false)
@Column(columnDefinition = "BINARY(16)", unique = true, nullable = false, updatable = false)
private UUID uuid;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application-h2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spring:
format_sql: true
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:klkldb;NON_KEYWORDS=USER;MODE=MySQL
url: jdbc:h2:mem:klkldb;MODE=MySQL
username: sa
password:
h2:
Expand All @@ -25,6 +25,6 @@ spring:
web-allow-others: true
sql:
init:
data-locations: classpath:database/data.sql
data-locations: classpath:database/data-h2.sql
mode: always
platform: h2
2 changes: 1 addition & 1 deletion src/main/resources/application-mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ spring:
database-platform: org.hibernate.dialect.MySQLDialect
sql:
init:
data-locations: classpath:database/data.sql
data-locations: classpath:database/data-mysql.sql
mode: always
153 changes: 153 additions & 0 deletions src/main/resources/database/data-h2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/* Member */
INSERT INTO member(id, uuid, name, tag, description, role, created_at)
VALUES (101, CAST(X'550e8400e29b41d4a716446655440000' AS UUID), 'test', '0001', '테스트입니다.', 'USER', CURRENT_TIMESTAMP),
(102, RANDOM_UUID(), 'dummy1', '0002', '더미1', 'USER', CURRENT_TIMESTAMP),
(103, RANDOM_UUID(), 'dummy2', '0003', '더미2', 'USER', CURRENT_TIMESTAMP);

/* Like */


/* Region */
INSERT INTO region(region_id, name)
VALUES (400, '동북아시아'),
(401, '동남아시아'),
(402, '기타');

INSERT INTO currency (currency_id, code, unit)
VALUES (438, 'JPY', ''),
(439, 'CNH', '위안'),
(440, 'TWD', '달러'),
(441, 'THB', '바트'),
(442, 'VND', ''),
(443, 'PHP', '페소'),
(444, 'SGD', '달러'),
(445, 'IDR', '루피아'),
(446, 'MYR', '링깃'),
(447, 'USD', '달러');

INSERT INTO country(country_id, region_id, name, code, wallpaper, currency_id)
VALUES (403, 400, '일본', 'JP', 'image/sample', 438),
(404, 400, '중국', 'CN', 'image/sample', 439),
(405, 400, '대만', 'TW', 'image/sample', 440),
(406, 401, '태국', 'TH', 'image/sample', 441),
(407, 401, '베트남', 'VN', 'image/sample', 442),
(408, 401, '필리핀', 'PH', 'image/sample', 443),
(409, 401, '싱가포르', 'SG', 'image/sample', 444),
(410, 401, '인도네시아', 'ID', 'image/sample', 445),
(411, 401, '말레이시아', 'MY', 'image/sample', 446),
(412, 402, '', 'GU', 'image/sample', 447),
(413, 402, '미국', 'US', 'image/sample', 447);

INSERT INTO city (city_id, country_id, name)
VALUES (414, 403, '오사카'),
(415, 403, '교토'),
(416, 403, '도쿄'),
(417, 403, '후쿠오카'),
(418, 403, '오키나와'),
(419, 403, '삿포로'),
(420, 403, '나고야'),
(421, 404, '홍콩'),
(422, 404, '상하이'),
(423, 404, '베이징'),
(424, 405, '타이베이'),
(425, 406, '방콕'),
(426, 406, '치앙마이'),
(427, 406, '푸켓'),
(428, 407, '다낭'),
(429, 407, '나트랑'),
(430, 407, '호치민'),
(431, 407, '하노이'),
(432, 408, '세부'),
(433, 408, '보라카이'),
(434, 409, '싱가포르'),
(435, 410, '발리'),
(436, 411, '코타키나발루'),
(437, 411, '쿠알라룸푸르'),
(448, 412, '투몬'),
(449, 413, '뉴욕'),
(450, 413, '로스엔젤레스'),
(451, 413, '하와이');

/* Category */
INSERT
INTO category(category_id, name)
VALUES (300, '식품'),
(301, '의류'),
(302, '잡화'),
(303, '화장품');

INSERT INTO subcategory (subcategory_id, name, category_id)
VALUES
-- 식품 카테고리 (category_id: 300)
(310, '라면 및 즉석식품', 300),
(311, '스낵 및 과자', 300),
(312, '조미료 및 소스', 300),
(313, '보충제 및 건강식품', 300),
(314, '음료 및 차', 300),
(315, '주류', 300),

-- 의류 카테고리 (category_id: 301)
(320, '상의', 301),
(321, '하의', 301),
(322, '아우터', 301),
(323, '원피스', 301),
(324, '신발', 301),
(325, '액세사리', 301),
(326, '쥬얼리', 301),

-- 잡화 카테고리 (category_id: 302)
(330, '일반의약품', 302),
(331, '주방잡화', 302),
(332, '욕실잡화', 302),
(333, '문구 및 완구', 302),

-- 화장품 카테고리 (category_id: 303)
(340, '스킨케어', 303),
(341, '메이크업', 303),
(342, '헤어케어', 303),
(343, '바디케어', 303),
(344, '위생용품', 303);

/* tag */
INSERT INTO tag (tag_id, name)
VALUES (350, '편의점'),
(351, '고수');

INSERT INTO subcategory_tag (subcategory_tag_id, subcategory_id, tag_id)
VALUES
--서브카테고리 필터 관계 테이블
-- 라면 및 즉석식품 - 필터
(360, 310, 350),
(361, 310, 351),
-- 스낵 및 과자 - 필터
(362, 311, 350),
(363, 311, 351),
--조미료 및 소스 - 필터
(364, 312, 350),
(365, 312, 351),
-- 보충제 및 건강식품 - 필터
(366, 313, 350),
-- 음료 및 차 - 필터
(367, 314, 350),
-- 주류 -필터
(368, 315, 350);

/* Product */
INSERT INTO product(product_id, member_id, name, description, address, price, like_count, rating,
city_id, subcategory_id, currency_id, created_at)
VALUES (101, 102, '곤약젤리', '탱글탱글 맛있는 곤약젤리', '신사이바시 메가돈키호테', 1000, 0, 5.0, 414, 311, 438, now()),
(102, 102, '여름 원피스', '시원하고 여름 휴양지 느낌의 원피스', '방콕 짜뚜짝 시장', 300, 333, 4.5, 425, 323, 441, now()),
(103, 103, '하오하오 봉지라면 핑크색', '새우맛이 나는 맛있는 라면', '롯데마트 나트랑', 15000, 500, 5.0, 429, 310, 442, now()),
(390, 101, '왕족발 보쌈 과자', '맛있는 왕족발 보쌈 과자', '상하이 장충동', 3000, 10, 3.0, 422, 311, 439, now());

/* Comment */
INSERT INTO comment(comment_id, product_id, member_id, content, created_at)
VALUES (500, 101, 101, '이거 정말 맛있는데 표현할 방법이 읎네.', now()),
(501, 390, 102, '이거 정말 맛없는데 표현할 방법이 읎네.', now()),
(502, 390, 103, '이거 정말 좋은데 표현할 방법이 읎네.', now());

/* Notification */
INSERT INTO notification(notification_id, is_read, created_at, comment_id)
VALUES (700, false, now(), 500),
(701, false, now(), 501),
(702, false, now(), 502);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Member */
INSERT INTO member(id, uuid, name, tag, description, role, created_at)
VALUES (101, '550e8400-e29b-41d4-a716-446655440000', 'test', '0001', '테스트입니다.', 'USER', now()),
(102, UUID(), 'dummy', '0002', '덤덤댄스', 'USER', now()),
(103, UUID(), 'dumdummy', '0003', '덤더미댄스', 'USER', now());
VALUES (101, UUID_TO_BIN('550e8400-e29b-41d4-a716-446655440000'), 'test', '0001', '테스트입니다.', 'USER', now()),
(102, UUID_TO_BIN(UUID()), 'dummy1', '0002', '더미1', 'USER', now()),
(103, UUID_TO_BIN(UUID()), 'dummy2', '0003', '더미2', 'USER', now());

/* Like */

Expand Down

0 comments on commit 86546a8

Please sign in to comment.