Repository navigation
refactor: DataStore 스키마 버전 관리 및 DataMigration 적용 - #979
Open
Sadturtleman wants to merge 3 commits into
Open
Sadturtleman wants to merge 3 commits into
Sadturtleman wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
DataStore에 스키마 버전을 함께 저장하고, 저장된 버전이 현재 버전보다 낮으면
DataMigration으로 저장값 자체를 현재 명세에 맞게 변환합니다.v1.9.0 배포 후 구버전 정렬 키(
"RECENT","OLD")가 DataStore에 남아 서재 목록이 비는 장애가 있었습니다. 지금까지는 읽을 때마다 매퍼에서 구 키를 변환했는데, 이 방식은 명세가 바뀔 때마다 읽기 코드에 레거시 분기가 쌓이고 저장값은 계속 구버전으로 남습니다. 자세한 배경은 DataStore에 남은 구버전 키 정리에 정리했습니다.공통 마이그레이션 (
VersionedPreferencesMigration)SCHEMA_VERSION키에 스키마 버전을 저장합니다. 키가 없으면 버전 관리 도입 이전(0)으로 봅니다.버전 → 버전 + 1)를 순서대로 적용하고 현재 버전을 기록합니다. 이미 현재 버전이면 실행하지 않습니다.versionCode가 아닌 저장소별 스키마 번호를 사용해, 배포마다 마이그레이션이 다시 돌지 않습니다.서재 필터 DataStore
RECENT→created_desc,OLD→created_asc)과 단일 별점(novelRating) → 별점 범위 변환을 읽기 경로에서LibraryFilterMigration(0 → 1)으로 옮겼습니다.novelRating)를 제거합니다. JSON으로 읽을 수 없는 값은 폐기합니다.그 밖의 DataStore
ACCOUNT_DATASTORE), 유저(USER_DATASTORE),user_preferences(app)에 스키마 버전 1을 도입했습니다. 현재는 변환 단계 없이 버전만 기록합니다.PENDING_FEED_LIKE_DATASTORE)에도 같은 방식으로 스키마 버전 1을 도입했습니다. 이 저장소에는 모든 키를 순회하거나clear()하는 코드가 없어 버전 키가 섞여도 영향이 없습니다.user_preferences는 기존SharedPreferencesMigration다음에 버전 마이그레이션이 실행됩니다.📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
UI 변경 없음
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴
VersionedPreferencesMigrationKDoc에 적었습니다. 앞으로 DataStore 키나 값 형식을 바꿀 때 참고 부탁드립니다.🤖 Generated with Claude Code