"""wechat_transfer_authorization 表(免确认收款授权) 商家转账「用户授权免确认收款模式」:用户授权一次后,后续提现免逐笔确认直接到账。 一个用户一条(user_id 主键)。out_authorization_no 我方生成,authorization_id 微信 active 后返回。 Revision ID: wx_transfer_auth Revises: withdraw_review_ad_watch Create Date: 2026-06-06 12:00:00.000000 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = 'wx_transfer_auth' down_revision: Union[str, Sequence[str], None] = 'withdraw_review_ad_watch' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.create_table( 'wechat_transfer_authorization', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('openid', sa.String(length=64), nullable=False), sa.Column('out_authorization_no', sa.String(length=64), nullable=False), sa.Column('authorization_id', sa.String(length=64), nullable=True), sa.Column('state', sa.String(length=16), server_default='pending', nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('user_id'), ) with op.batch_alter_table('wechat_transfer_authorization', schema=None) as batch_op: batch_op.create_index( batch_op.f('ix_wechat_transfer_authorization_out_authorization_no'), ['out_authorization_no'], unique=True, ) def downgrade() -> None: with op.batch_alter_table('wechat_transfer_authorization', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_wechat_transfer_authorization_out_authorization_no')) op.drop_table('wechat_transfer_authorization')