- 移除后端产品、目的地、活动专题等废弃模块的数据库表与业务代码,删除冗余API接口 - 删除小程序端详情页、线路组件等冗余代码,移除搜索工具与测试用例,调整导航逻辑 - 清理管理端废弃的类型定义、编辑器与测试代码 - 更新项目文档,修正模块维护说明与接口文档内容
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
"""Remove the retired province destination module.
|
|
|
|
Revision ID: 0010_remove_destination_module
|
|
Revises: 0009_remove_product_domain
|
|
Create Date: 2026-08-17
|
|
"""
|
|
|
|
from alembic import op
|
|
from sqlalchemy import inspect
|
|
|
|
|
|
revision = "0010_remove_destination_module"
|
|
down_revision = "0009_remove_product_domain"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def _drop_referencing_foreign_keys(table_name: str) -> None:
|
|
bind = op.get_bind()
|
|
inspector = inspect(bind)
|
|
for current_table in inspector.get_table_names():
|
|
if current_table == table_name:
|
|
continue
|
|
for foreign_key in inspector.get_foreign_keys(current_table):
|
|
if foreign_key.get("referred_table") != table_name:
|
|
continue
|
|
constraint_name = foreign_key.get("name")
|
|
if constraint_name:
|
|
op.drop_constraint(constraint_name, current_table, type_="foreignkey")
|
|
|
|
|
|
def upgrade() -> None:
|
|
bind = op.get_bind()
|
|
existing_tables = set(inspect(bind).get_table_names())
|
|
|
|
for table_name in ("DestinationAlias", "Destination"):
|
|
if table_name not in existing_tables:
|
|
continue
|
|
_drop_referencing_foreign_keys(table_name)
|
|
op.drop_table(table_name)
|
|
|
|
|
|
def downgrade() -> None:
|
|
# The retired destination module has no downgrade path. Restore it from a backup if needed.
|
|
pass
|