feat(huya): 统一实时商品目录并增加兑换代理开关
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
"""虎牙精英宝典兑换增加独立代理开关。
|
||||
|
||||
默认关闭;开启后兑换链路才读取全局代理配置。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "20261113_0081"
|
||||
down_revision: str | None = "20261112_0080"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
TABLE = "huya_config"
|
||||
COLUMN = "exchange_use_proxy"
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
if not inspector.has_table(TABLE):
|
||||
return
|
||||
existing = {column["name"] for column in inspector.get_columns(TABLE)}
|
||||
if COLUMN not in existing:
|
||||
op.add_column(
|
||||
TABLE,
|
||||
sa.Column(
|
||||
COLUMN,
|
||||
sa.String(length=1),
|
||||
nullable=False,
|
||||
server_default="0",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
if not inspector.has_table(TABLE):
|
||||
return
|
||||
existing = {column["name"] for column in inspector.get_columns(TABLE)}
|
||||
if COLUMN in existing:
|
||||
op.drop_column(TABLE, COLUMN)
|
||||
Reference in New Issue
Block a user