Skip to content

feat: payment 서버 데이터를 backend로 마이그레이션하는 스크립트 추가#45

Open
MU-Software wants to merge 3 commits into
mainfrom
feature/migrate-legacy-data
Open

feat: payment 서버 데이터를 backend로 마이그레이션하는 스크립트 추가#45
MU-Software wants to merge 3 commits into
mainfrom
feature/migrate-legacy-data

Conversation

@MU-Software
Copy link
Copy Markdown
Member

주요 변경 사항

  • 제곧내입니다, payment 서버 데이터를 backend로 마이그레이션하는 스크립트를 추가합니다.
  • 프로덕션 데이터를 덤프하여 마스킹 처리 후, 로컬에서 마이그레이션 테스트 완료했습니다.

@MU-Software MU-Software changed the base branch from main to feature/migrate-purchase-repo May 12, 2026 09:26
Base automatically changed from feature/migrate-purchase-repo to main May 12, 2026 17:40
@MU-Software MU-Software force-pushed the feature/migrate-legacy-data branch from ffa69bc to 660af08 Compare May 12, 2026 17:45
- auto_username: 위 미매칭 + username 동일 (같은 사람이 다른 email 로 양쪽 가입한 케이스)
- manual: hardcoded — darjeeling@gmail.com (legacy id 5, 1135) → backend darjeeling@python.or.kr (id 5)
- shifted: 모두 미매칭 → legacy.id + USER_ID_OFFSET (backend max id 와 충돌 없는 여유 공간)
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자세하게 주석 남겨주셔서 감사합니다!
혹시 shifted case는 어떤 경우일까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 운영진이 아닌 일반 티켓 구매 참가자분들입니다ㅎㅎ

Comment on lines +294 to +304
class Migration(migrations.Migration):
dependencies = [
("user", "0009_alter_historicaluserext_options_and_more"),
("order", "0001_initial"),
("product", "0001_initial"),
("payment_history", "0001_initial"),
# allauth — socialaccount/account 테이블 선행 생성
("socialaccount", "0006_alter_socialaccount_extra_data"),
("account", "0009_emailaddress_unique_primary_email"),
]
operations = [migrations.RunPython(migrate_data, reverse_code=migrations.RunPython.noop)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중간에 실패하는 경우를 대비해서 롤백이나 transaction 관련 설정이 추가되면 좋을 것 같습니다!

Comment on lines +4 to +18
# 사전 계산값. 새 URL 이 발견되면 여기에 추가하거나 RunPython 결과를 확인할 것.
LEGACY_IMAGE_META: dict[str, dict] = {
"https://s3.ap-northeast-2.amazonaws.com/pyconkr-backend-prod-public/public/t-shirt-compressed.png": {
"file_path": "public/t-shirt-compressed.png",
"hash": "d131452cf6cd2287e4c302f4f7c17bb5",
"size": 2069683,
"mimetype": "image/png",
},
"https://s3.ap-northeast-2.amazonaws.com/pyconkr-backend-prod-public/public/t-shirt-comporessed-2.png": {
"file_path": "public/t-shirt-comporessed-2.png",
"hash": "30acab0125661cac1ce75c4a4633042a",
"size": 2278886,
"mimetype": "image/png",
},
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 가능하다면, 이런 URL을 .env의 환경변수로 빼도 좋을 것 같습니다!

  • 형식이 정해져야 한다면 type을 사용해도 좋을 것 같아요!

Comment on lines +48 to +50
class Migration(migrations.Migration):
dependencies = [("file", "0001_initial"), ("product", "0001_initial")]
operations = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operation이 여러 개라서 transaction 처리가 추가되면 좋을 것 같습니다!

Copy link
Copy Markdown
Contributor

@earthyoung earthyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants