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

인덱스 변경, 리팩토링 #197

Merged
merged 4 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@Table(
name="match_tb",
indexes = {
@Index(name = "match_couple_planner_index", columnList = "planner_id,couple_id"),
@Index(name = "match_couple_planner_index", columnList = "couple_id,planner_id"),
@Index(name = "match_chat_index", columnList = "chat_id")
})
@SQLDelete(sql = "UPDATE match_tb SET is_active = false WHERE id = ?")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Entity
@Table(
name = "review_imageitem_tb",
name = "review_image_item_tb",
indexes = {
@Index(name = "review_index", columnList = "review_id")
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.kakao.sunsuwedding.review.image;

import com.kakao.sunsuwedding.review.image.ReviewImageItem;
import com.kakao.sunsuwedding.review.image.ReviewImageItemJDBCRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
Expand All @@ -19,7 +17,7 @@ public ReviewImageItemJDBCRepositoryImpl(JdbcTemplate jdbcTemplate) {
}

public void batchInsertImageItems(List<ReviewImageItem> reviewImageItems) {
String sql = "INSERT INTO review_imageitem_tb (review_id, image, thumbnail) VALUES (?, ?, ?)";
String sql = "INSERT INTO review_image_item_tb (review_id, image, thumbnail) VALUES (?, ?, ?)";

jdbcTemplate.batchUpdate(sql, reviewImageItems, reviewImageItems.size(),
(ps, imageItem) -> {
Expand Down
19 changes: 9 additions & 10 deletions sunsu-wedding/src/main/resources/db/teardown.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ truncate table match_tb;
truncate table quotation_tb;
truncate table chat_tb;
truncate table review_tb;
truncate table review_imageitem_tb;
truncate table review_image_item_tb;
truncate table favorite_tb;
SET REFERENTIAL_INTEGRITY TRUE;

Expand Down Expand Up @@ -135,15 +135,14 @@ INSERT INTO quotation_tb (`id`, `match_id`, `title`, `price`, `company`, `descri
INSERT INTO review_tb (`id`, `match_id`, `stars`, `content`, `created_at`, `modified_at`, `is_active`) VALUES (1, 1, 5, '최고의 플래너!', '2023-10-08 08:30:12.00', '2023-10-08 08:30:12.00', true);
INSERT INTO review_tb (`id`, `match_id`, `stars`, `content`, `created_at`, `modified_at`, `is_active`) VALUES (2, 6, 5, '님 진짜 최고셈!', '2023-10-08 08:30:12.00', '2023-10-08 08:30:12.00', true);


INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('1', '1', '/wAA', 'true');
INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('2', '1', '/wAA', 'false');
INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('3', '1', '/wAA', 'false');
INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('4', '1', '/wAA', 'false');
INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('5', '1', '/wAA', 'false');
INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('6', '2', '/wAA', 'true');
INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('7', '2', '/wAA', 'false');
INSERT INTO review_imageitem_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('8', '2', '/wAA', 'false');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('1', '1', '/wAA', 'true');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('2', '1', '/wAA', 'false');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('3', '1', '/wAA', 'false');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('4', '1', '/wAA', 'false');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('5', '1', '/wAA', 'false');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('6', '2', '/wAA', 'true');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('7', '2', '/wAA', 'false');
INSERT INTO review_image_item_tb (`id`, `review_id`, `image`, `thumbnail`) VALUES ('8', '2', '/wAA', 'false');



Expand Down
Loading