15dcfa604b
- comparison_record 表 + 上报(幂等 user+trace)/列表/详情 接口;服务端派生 best/saved/is_source_best/status + information(done 帧文案/失败具体原因) - 战绩里程碑:comparison_milestone_claim 表 + 进度/领取接口,按成功比价次数 解锁,复用 grant_coins 真发金币(RECORD_MILESTONES 120/180/300/500/800/1200) - 迁移 record/information/milestone 三个,单 head;rewards.py 集中档位配置 - 测试 test_compare_record(8)+test_compare_milestone(7) 全绿;docs/api 12a-12e + 索引 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
"""comparison_milestone_claim table (比价战绩里程碑领取记录)
|
|
|
|
Revision ID: d4e5f6a7b8c9
|
|
Revises: c3d4e5f6a7b8
|
|
Create Date: 2026-05-31 18:00:00.000000
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'd4e5f6a7b8c9'
|
|
down_revision: Union[str, Sequence[str], None] = 'c3d4e5f6a7b8'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
'comparison_milestone_claim',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
sa.Column('milestone', sa.Integer(), nullable=False),
|
|
sa.Column('coin_awarded', sa.Integer(), nullable=False),
|
|
sa.Column('claimed_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('user_id', 'milestone', name='uq_compare_milestone_user'),
|
|
)
|
|
with op.batch_alter_table('comparison_milestone_claim', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_comparison_milestone_claim_user_id'), ['user_id'], unique=False)
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table('comparison_milestone_claim', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_comparison_milestone_claim_user_id'))
|
|
|
|
op.drop_table('comparison_milestone_claim')
|