Skip to content
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
90 changes: 90 additions & 0 deletions docs/s3-image-url-migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
-- S3 image URL migration draft only.
-- Do not execute automatically. Back up the database and verify object parity first.
-- This script changes URLs only when they use the old S3 host.

START TRANSACTION;

UPDATE tb_file
SET file_saved_name = REPLACE(
file_saved_name,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE file_saved_name LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_file
SET thumb_saved_name = REPLACE(
thumb_saved_name,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE thumb_saved_name LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_building
SET image_url = REPLACE(
image_url,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE image_url LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_building_image
SET image = REPLACE(
image,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE image LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_place
SET image_url = REPLACE(
image_url,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE image_url LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_character
SET image_url = REPLACE(
image_url,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE image_url LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_pub_image
SET image_url = REPLACE(
image_url,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE image_url LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_suggestion_image
SET image_url = REPLACE(
image_url,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE image_url LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

UPDATE tb_push_dispatch
SET image_url = REPLACE(
image_url,
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com',
'https://kodaero-images.s3.ap-southeast-2.amazonaws.com'
)
WHERE image_url LIKE
'https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/%';

-- Review row counts and verify changed URLs before committing.
-- COMMIT;
-- ROLLBACK;
32 changes: 16 additions & 16 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ cloud:
access-key: ${BUCKET_ACCESS_KEY}
secret-key: ${BUCKET_SECRET_KEY}
region:
static: ap-northeast-2
static: ap-southeast-2

springdoc:
api-docs:
Expand All @@ -114,27 +114,27 @@ springdoc:

profile:
image:
lv1-url: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/profile/lv1.jpg
lv2-url: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/profile/lv2.jpg
lv3-url: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/profile/lv3.jpg
lv4-url: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/profile/lv4.jpg
lv5-url: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/profile/lv5.jpg
lv1-url: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/profile/lv1.jpg
lv2-url: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/profile/lv2.jpg
lv3-url: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/profile/lv3.jpg
lv4-url: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/profile/lv4.jpg
lv5-url: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/profile/lv5.jpg

character:
image: # 캐릭터 이미지 (피그마 확정 이미지를 이 경로 규칙대로 S3에 업로드: {base-url}/{NN_slug}.png)
base-url: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/character
base-url: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/character

place:
default-image:
cafe: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/CAFE.jpg
cafeteria: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/CAFETERIA.jpg
convenience-store: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/CONVENIENCE_STORE.jpg
gym: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/GYM.jpg
lounge: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/LOUNGE.jpg
reading-room: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/READING_ROOM.jpg
shower-room: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/SHOWER_ROOM.jpg
sleeping-room: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/SLEEPING_ROOM.jpg
study-room: https://kodaero-ku.s3.ap-northeast-2.amazonaws.com/place/default_image/STUDY_ROOM.jpg
cafe: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/CAFE.jpg
cafeteria: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/CAFETERIA.jpg
convenience-store: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/CONVENIENCE_STORE.jpg
gym: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/GYM.jpg
lounge: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/LOUNGE.jpg
reading-room: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/READING_ROOM.jpg
shower-room: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/SHOWER_ROOM.jpg
sleeping-room: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/SLEEPING_ROOM.jpg
study-room: https://kodaero-images.s3.ap-southeast-2.amazonaws.com/place/default_image/STUDY_ROOM.jpg

date:
api:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"cloud.aws.s3.bucket=test-bucket",
"cloud.aws.credentials.access-key=test-access-key",
"cloud.aws.credentials.secret-key=test-secret-key",
"cloud.aws.region.static=ap-northeast-2",
"cloud.aws.region.static=ap-southeast-2",
"date.api.holiday.end-point=http://localhost",
"date.api.holiday.encoded-key=test-encoded-key",
"date.api.holiday.decoded-key=test-decoded-key",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"cloud.aws.s3.bucket=test-bucket",
"cloud.aws.credentials.access-key=test-access-key",
"cloud.aws.credentials.secret-key=test-secret-key",
"cloud.aws.region.static=ap-northeast-2",
"cloud.aws.region.static=ap-southeast-2",
"date.api.holiday.end-point=http://localhost",
"date.api.holiday.encoded-key=test-encoded-key",
"date.api.holiday.decoded-key=test-decoded-key",
Expand Down
Loading