af615a9853
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""phone_rebind_log 表(M2 换绑 30 天限制台账)
|
|
|
|
Revision ID: phone_rebind_log
|
|
Revises: comparison_llm_cost
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "phone_rebind_log"
|
|
down_revision = "comparison_llm_cost"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"phone_rebind_log",
|
|
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column("phone", sa.String(length=20), nullable=False),
|
|
sa.Column("old_user_id", sa.Integer(), nullable=True),
|
|
sa.Column("new_user_id", sa.Integer(), nullable=False),
|
|
sa.Column("source", sa.String(length=32), nullable=False, server_default="wechat_conflict"),
|
|
sa.Column("rebound_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
)
|
|
op.create_index("ix_phone_rebind_log_phone", "phone_rebind_log", ["phone"])
|
|
op.create_index("ix_phone_rebind_log_rebound_at", "phone_rebind_log", ["rebound_at"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_phone_rebind_log_rebound_at", table_name="phone_rebind_log")
|
|
op.drop_index("ix_phone_rebind_log_phone", table_name="phone_rebind_log")
|
|
op.drop_table("phone_rebind_log")
|