-
Notifications
You must be signed in to change notification settings - Fork 2
[FEAT] S3 파일 저장 구조를 Object Key 기반으로 변경 #166
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ee0ba74
refactor: 녹음 파일 URL 저장을 Object Key 저장 방식으로 변경 (#160)
on1yoneprivate 107c374
feat: Object Key 기반 녹음 파일 조회 기능 추가 (#160)
on1yoneprivate 344690a
test: Object Key 저장 구조에 맞게 테스트 코드 수정 (#160)
on1yoneprivate ac0f1b4
fix: 녹음 파일 Object Key 유효성 검증 추가 (#160)
on1yoneprivate 4b9b2ca
fix: recording_object_key 마이그레이션 검증 로직 추가 (#160)
on1yoneprivate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/resources/db/migration/V5__migrate_recording_file_url_to_object_key.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| -- 1. 컬럼명 변경 | ||
| ALTER TABLE playing | ||
| RENAME COLUMN recording_file_url TO recording_object_key; | ||
|
|
||
| -- 2. URL에서 S3 Object Key만 추출 | ||
| UPDATE playing | ||
| SET recording_object_key = regexp_replace( | ||
| recording_object_key, | ||
| '^(https?://[^/]+/)?([^?#]*).*$', | ||
| '\2' | ||
| ) | ||
| WHERE recording_object_key IS NOT NULL | ||
| AND btrim(recording_object_key) <> ''; | ||
|
|
||
| -- 3. 검증: 실패 시 예외 발생 → Flyway가 트랜잭션 롤백 처리 | ||
| DO $$ | ||
| BEGIN | ||
| IF EXISTS ( | ||
| SELECT 1 | ||
| FROM playing | ||
| WHERE recording_object_key IS NOT NULL | ||
| AND ( | ||
| recording_object_key LIKE '%?%' | ||
| OR recording_object_key LIKE 'http%' | ||
| OR recording_object_key LIKE '%X-Amz%' | ||
| OR btrim(recording_object_key) = '' | ||
| ) | ||
| ) THEN | ||
| RAISE EXCEPTION 'recording_object_key migration validation failed'; | ||
| END IF; | ||
| END | ||
| $$; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.