Core Changes: - Migrate portfolio_id from string to UUID in schema and repository layer - Update portfolio CLI commands to use name+user combination for identification - Update HTTP API to accept portfolio_id as UUID path parameter - Implement portfolio ownership validation in repository queries Requirements Completed (REQ-016 to REQ-019): - REQ-016: portfolios table UUID schema migration with data migration script - REQ-017: CLI portfolio commands with name+user identification - REQ-018: HTTP API portfolio path parameters and v1 asset_id UUID returns - REQ-019: Portfolio UUID baseline documentation updates BAT-001 Re-verification: - REQ-004~010 marked as Implemented after verification evidence validation - All v1 API endpoints verified with comprehensive test coverage Documentation Updates: - Update data-model.md with portfolio UUID structure - Update interface-contract.md with UUID path parameters - Update runtime-flows.md with ownership-based resolution flows - Update project-structure.md with database layer changes - Add migration script for portfolio UUID transition Testing: - Add test_portfolio_uuid.py for migration validation - Update test_cli.py and test_portfolio_ownership.py for ownership checks
2.0 KiB
2.0 KiB
BAT-006 Index
- BAT ID: BAT-006
- Profile: standard
- Status: release-candidate
- Source Discovery: dcy-004
- Date Created: 2026-05-11
- Folder: docs/batches/bat-006_20260511_portfolio-uuid-migration/
Included REQ
| REQ | Title | Type | Priority |
|---|---|---|---|
| REQ-016 | portfolios 테이블 UUID 전환 및 데이터 마이그레이션 | Migration | High |
| REQ-017 | CLI portfolio 명령 — name+user 조합 식별 방식 전환 | Interface | High |
| REQ-018 | HTTP API portfolio path parameter UUID 전환 및 v1 asset_id UUID 반환 | Interface | High |
| REQ-019 | portfolio UUID 전환 관련 baseline 문서 갱신 | Documentation | Medium |
Scope Summary
portfolios.portfolio_id를 사용자 지정 TEXT에서 서버 생성 UUID(TEXT)로 교체하고, 기존portfolio_id문자열을name컬럼으로 이전한다.(owner_user_id, name)복합 UNIQUE 제약을 DB 레벨에서 도입해 사용자 범위 내 이름 유일성을 보장한다.- 기존 데이터와 FK 참조 테이블(portfolio_ledger, portfolio_comments, portfolio_tags, ledger_trades)을 단일 Alembic revision으로 atomic하게 마이그레이션한다.
- CLI portfolio 뮤테이션 명령을
<name>+--user <username>조합 식별 방식으로 전환하고, 내부에서(owner_user_id, name)→ UUID 단일 쿼리 조회로 처리한다. - HTTP API path parameter 및
GET /v1/assetsasset_id반환을 UUID 기반으로 전환하고, dcy-002 A-3 조항을 공식 철회한다. - 위 변경 사항을 baseline 문서(docs/project-structure.md, docs/runtime-flows.md, docs/data-model.md, docs/interface-contract.md)에 반영한다.
Delivery Documents
| Stage | File | Status |
|---|---|---|
| Index | index.md | release-candidate |
| Planning | planning.md | confirmed |
| Design | design.md | confirmed |
| Implementation | implementation.md | completed |
| Verification | verification.md | passed |