feat: REQ-001~018 Implemented 전환, REQ-010 GET /v1/assets admin catalog 재정의, REL-001 draft
- confirm-req-implemented: REQ-001~018 (17건, REQ-013 제외) Approved → Implemented - BAT-001(REQ-009/011/014), BAT-002(REQ-010/012/015), BAT-003(REQ-001/002/003/006) - BAT-004(REQ-004/005), BAT-005(REQ-007/008), BAT-006(REQ-016/017/018) - CHG-20260521-01 entry 각 REQ에 추가; SRS index Recent Change Log 갱신 - REQ-010 CHG-20260521-02: GET /v1/assets admin catalog 전용 재정의 - 기존 token_type 분기 portfolio 조회 코드 제거, admin permission + list_assets() 호출로 대체 - AssetCatalogListResponse 스키마 추가 (items/total) - REQ-010 Status: Implemented → Approved (재검증 필요) - 테스트 343건 전체 통과: service/user token 403, admin token 200 + catalog schema 검증 - migration 보강: portfolios_asset_migration market 컬럼 부재 fallback, portfolio_tags 빈 테이블 early-return, service_token index fix autocommit_block 정리 - docs/releases/rel-001: REL-001 draft 추가 (BAT-001~011 포함) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,20 +31,31 @@ def upgrade() -> None:
|
||||
inspector = inspect(bind)
|
||||
|
||||
# Step 1: Populate assets catalog from existing portfolios (REQ-014)
|
||||
# Only if portfolios.symbol column still exists (idempotent guard)
|
||||
# Only if portfolios.symbol column still exists (idempotent guard).
|
||||
# portfolios.market 컬럼은 이전 BAT-008 migration(20260502_0014) 또는
|
||||
# ensure_schema() 경로에 따라 존재하지 않을 수 있다. REQ-014 본문 "market 값이
|
||||
# NULL인 기존 행은 빈 배열로 처리"에 따라 컬럼 부재 시 markets=[]로 fallback.
|
||||
if _column_exists(inspector, "portfolios", "symbol"):
|
||||
bind.execute(text("""
|
||||
INSERT INTO assets (symbol, markets)
|
||||
SELECT
|
||||
symbol,
|
||||
COALESCE(
|
||||
ARRAY_AGG(DISTINCT market) FILTER (WHERE market IS NOT NULL),
|
||||
ARRAY[]::text[]
|
||||
)
|
||||
FROM portfolios
|
||||
GROUP BY symbol
|
||||
ON CONFLICT (symbol) DO NOTHING
|
||||
"""))
|
||||
if _column_exists(inspector, "portfolios", "market"):
|
||||
bind.execute(text("""
|
||||
INSERT INTO assets (symbol, markets)
|
||||
SELECT
|
||||
symbol,
|
||||
COALESCE(
|
||||
ARRAY_AGG(DISTINCT market) FILTER (WHERE market IS NOT NULL),
|
||||
ARRAY[]::text[]
|
||||
)
|
||||
FROM portfolios
|
||||
GROUP BY symbol
|
||||
ON CONFLICT (symbol) DO NOTHING
|
||||
"""))
|
||||
else:
|
||||
bind.execute(text("""
|
||||
INSERT INTO assets (symbol, markets)
|
||||
SELECT DISTINCT symbol, ARRAY[]::text[]
|
||||
FROM portfolios
|
||||
ON CONFLICT (symbol) DO NOTHING
|
||||
"""))
|
||||
|
||||
# Step 2: Add portfolios.asset_id column (nullable, temporary)
|
||||
if not _column_exists(inspector, "portfolios", "asset_id"):
|
||||
|
||||
Reference in New Issue
Block a user