功能: 接入鱼翅供应商直充渠道
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""增加斗鱼鱼翅充值渠道配置
|
||||
|
||||
Revision ID: 20260813_0026
|
||||
Revises: 20260813_0025
|
||||
Create Date: 2026-08-13
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision: str = "20260813_0026"
|
||||
down_revision: Union[str, None] = "20260813_0025"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _columns(bind) -> set[str]:
|
||||
return {column["name"] for column in sa.inspect(bind).get_columns("douyu_config")}
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
if not sa.inspect(bind).has_table("douyu_config"):
|
||||
return
|
||||
columns = _columns(bind)
|
||||
additions = (
|
||||
("gold_recharge_channel", sa.Column("gold_recharge_channel", sa.String(length=16), nullable=True, server_default="wechat_qr")),
|
||||
("gold_api_product_id", sa.Column("gold_api_product_id", sa.String(length=128), nullable=True, server_default="111570")),
|
||||
("gold_api_account_template_name", sa.Column("gold_api_account_template_name", sa.String(length=64), nullable=True, server_default="斗鱼UID")),
|
||||
)
|
||||
for name, column in additions:
|
||||
if name not in columns:
|
||||
op.add_column("douyu_config", column)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
if not sa.inspect(bind).has_table("douyu_config"):
|
||||
return
|
||||
columns = _columns(bind)
|
||||
for name in ("gold_api_account_template_name", "gold_api_product_id", "gold_recharge_channel"):
|
||||
if name in columns:
|
||||
op.drop_column("douyu_config", name)
|
||||
Reference in New Issue
Block a user