refactor(weibo): 移除兑换待确认状态

This commit is contained in:
yml
2026-11-12 19:28:53 +08:00
parent 56e5d0ea1c
commit 275ae7f241
6 changed files with 104 additions and 28 deletions
@@ -0,0 +1,35 @@
"""微博外部单协作移除「兑换待确认」状态,存量订单归入「已充值」。"""
from __future__ import annotations
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "20261112_0079"
down_revision: str | None = "20261112_0078"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
TABLE = "weibo_external_orders"
def upgrade() -> None:
bind = op.get_bind()
if not sa.inspect(bind).has_table(TABLE):
return
bind.execute(
sa.text(
f"""
UPDATE {TABLE}
SET status = 'recharged',
recharged_at = COALESCE(recharged_at, exchange_started_at, updated_at, created_at)
WHERE status = 'exchange_pending'
"""
)
)
def downgrade() -> None:
"""旧状态没有独立业务含义,降级时保持「已充值」。"""