-
Notifications
You must be signed in to change notification settings - Fork 4
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
Refactor : shop 조회 response에 updated_at 추가 #212
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. V72.000_ 가 아니라 컨벤션 유의해주세요~ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DELIMITER $$ | ||
|
||
CREATE TRIGGER update_shop_updated_at_opens | ||
AFTER UPDATE | ||
ON shop_opens | ||
FOR EACH ROW | ||
|
||
BEGIN | ||
UPDATE shops SET updated_at = NEW.updated_at WHERE shops.id = NEW.shop_id; | ||
END $$ | ||
|
||
DELIMITER ; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DELIMITER $$ | ||
|
||
CREATE TRIGGER update_shop_updated_at_category | ||
AFTER UPDATE | ||
ON shop_category_map | ||
FOR EACH ROW | ||
|
||
BEGIN | ||
UPDATE shops SET updated_at = NEW.updated_at WHERE shops.id = NEW.shop_id; | ||
END $$ | ||
|
||
DELIMITER ; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 마지막 라인에 뉴 라인이 추가되어야 할 것 같아요 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DELIMITER $$ | ||
|
||
CREATE TRIGGER update_shop_updated_at_images | ||
AFTER UPDATE | ||
ON shop_images | ||
FOR EACH ROW | ||
|
||
BEGIN | ||
UPDATE shops SET updated_at = NEW.updated_at WHERE shops.id = NEW.shop_id; | ||
END $$ | ||
|
||
DELIMITER ; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DELIMITER $$ | ||
|
||
CREATE TRIGGER update_shop_updated_at_menus | ||
AFTER UPDATE | ||
ON shop_menus | ||
FOR EACH ROW | ||
|
||
BEGIN | ||
UPDATE shops SET updated_at = NEW.updated_at WHERE shops.id = NEW.shop_id; | ||
END $$ | ||
|
||
DELIMITER ; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DELIMITER $$ | ||
|
||
CREATE TRIGGER update_shop_updated_at_menus_category | ||
AFTER UPDATE | ||
ON shop_menu_category_map | ||
FOR EACH ROW | ||
|
||
BEGIN | ||
UPDATE shop_menus SET updated_at = NEW.updated_at WHERE shop_menus.id = NEW.shop_menu_id; | ||
END $$ | ||
|
||
DELIMITER ; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DELIMITER $$ | ||
|
||
CREATE TRIGGER update_shop_updated_at_menus_detatils | ||
AFTER UPDATE | ||
ON shop_menu_details | ||
FOR EACH ROW | ||
|
||
BEGIN | ||
UPDATE shop_menus SET updated_at = NEW.updated_at WHERE shop_menus.id = NEW.shop_menu_id; | ||
END $$ | ||
|
||
DELIMITER ; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 트리거를 이용하여 메뉴, 이미지, 카테고리가 update될 때 상점의 updated_at이 변경되도록 수정됐다고 이해했는데 update될 때만 변경되면 될까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. create, delete 때도 필요할 것 같습니다.. 추가하겠습니다! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shop_opens 테이블의 경우에는 soft delete인데 delete에 관한 트리거를 추가할 필요가 있을까요? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DELIMITER $$ | ||
|
||
CREATE TRIGGER update_shop_updated_at_menus_images | ||
AFTER UPDATE | ||
ON shop_menu_images | ||
FOR EACH ROW | ||
|
||
BEGIN | ||
UPDATE shop_menus SET updated_at = NEW.updated_at WHERE shop_menus.id = NEW.shop_menu_id; | ||
END $$ | ||
|
||
DELIMITER ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍