- 移除所有废弃的旧首页配置模块,包括destinationHero、demand相关、HomeExperience、vehicleService等表结构与代码,新增数据库迁移删除遗留表 - 重构管理端后台布局为标准RuoYi风格,新增Sidebar、Navbar、SettingsDrawer等组件,替换旧的过渡菜单实现 - 调整移动端响应断点为768px,更新布局相关测试用例,新增布局组件测试 - 删除OperationsTools发布/重置页面,移除/tools菜单入口,清理对应的API调用与测试代码 - 重构玩法模块编辑器:替换旧的图片手动输入框为图片上传组件,移除冗余的取消按钮 - 新增线索查询offset参数支持,完善查询参数处理逻辑 - 优化rbac菜单构建逻辑,新增可见性控制参数 - 修正管家编辑器提示文案,优化系统资源编辑器表单初始化逻辑 - 清理小程序端废弃的体验推荐组件与相关测试代码 - 更新文档与种子脚本,匹配新的API契约与使用说明
84 lines
2.8 KiB
Python
84 lines
2.8 KiB
Python
"""Add long-form detail content to homepage team buildings.
|
|
|
|
Revision ID: 0020_home_team_building_details
|
|
Revises: 0019_home_wild_archive_images
|
|
"""
|
|
|
|
from alembic import context, op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy import inspect
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
|
|
revision = "0020_home_team_building_details"
|
|
down_revision = "0019_home_wild_archive_images"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
DETAIL_COLUMNS = {"detailSubtitle", "detailParagraphs"}
|
|
|
|
|
|
def missing_detail_columns(existing_columns: set[str]) -> set[str]:
|
|
return DETAIL_COLUMNS.difference(existing_columns)
|
|
|
|
|
|
def is_offline_mode() -> bool:
|
|
try:
|
|
return context.is_offline_mode()
|
|
except (NameError, AttributeError):
|
|
return False
|
|
|
|
|
|
def upgrade() -> None:
|
|
if is_offline_mode():
|
|
columns_to_add = DETAIL_COLUMNS
|
|
else:
|
|
bind = op.get_bind()
|
|
existing_columns = {column["name"] for column in inspect(bind).get_columns("HomeTeamBuilding")}
|
|
columns_to_add = missing_detail_columns(existing_columns)
|
|
|
|
if "detailSubtitle" in columns_to_add:
|
|
op.add_column(
|
|
"HomeTeamBuilding",
|
|
sa.Column("detailSubtitle", sa.String(), nullable=False, server_default=""),
|
|
)
|
|
if "detailParagraphs" in columns_to_add:
|
|
op.add_column(
|
|
"HomeTeamBuilding",
|
|
sa.Column(
|
|
"detailParagraphs",
|
|
postgresql.JSONB(astext_type=sa.Text()),
|
|
nullable=False,
|
|
server_default=sa.text("'[]'::jsonb"),
|
|
),
|
|
)
|
|
op.execute(
|
|
sa.text(
|
|
'UPDATE "HomeTeamBuilding" '
|
|
'SET "detailSubtitle" = CASE '
|
|
'WHEN COALESCE("detailSubtitle", \'\') = \'\' THEN "description" '
|
|
'ELSE "detailSubtitle" END, '
|
|
'"detailParagraphs" = CASE '
|
|
'WHEN "detailParagraphs" IS NULL OR jsonb_typeof("detailParagraphs") <> \'array\' '
|
|
'OR (jsonb_typeof("detailParagraphs") = \'array\' '
|
|
'AND jsonb_array_length("detailParagraphs") = 0) '
|
|
'THEN jsonb_build_array("description") '
|
|
'ELSE "detailParagraphs" END '
|
|
'WHERE COALESCE("detailSubtitle", \'\') = \'\' '
|
|
'OR "detailParagraphs" IS NULL '
|
|
'OR jsonb_typeof("detailParagraphs") <> \'array\' '
|
|
'OR (jsonb_typeof("detailParagraphs") = \'array\' '
|
|
'AND jsonb_array_length("detailParagraphs") = 0)'
|
|
)
|
|
)
|
|
if "detailSubtitle" in columns_to_add:
|
|
op.alter_column("HomeTeamBuilding", "detailSubtitle", server_default=None)
|
|
if "detailParagraphs" in columns_to_add:
|
|
op.alter_column("HomeTeamBuilding", "detailParagraphs", server_default=None)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("HomeTeamBuilding", "detailParagraphs")
|
|
op.drop_column("HomeTeamBuilding", "detailSubtitle")
|