PayrollManagementSystem/backend/alembic/versions/07b8c9d0e1f2_tplus_index_names.py
liuwenxin 108bf87225 feat(核算)!: 添加 T+ 正式核算与采集托管
补齐源快照、资料预演、正式导入及工资核算的依赖链路。
新增版本化输入、逐段 FIFO、生成锁和结构化当月调整,
并提供默认关闭的周期采集、有限重试及 Windows 托管。

原始客户资料、私有配置及首页改动不纳入本次提交。

BREAKING CHANGE: 升级前需应用新增迁移,并通过
PAYROLL_MAKER_USER_ID 绑定实际工资制作人,否则业务只读。
旧单批次核算默认关闭;历史兼容需显式启用
PAYROLL_ALLOW_LEGACY_CALCULATION。生产启用和真实金额待验收。
2026-11-02 09:42:53 +08:00

28 lines
993 B
Python

"""V17 对齐 V16 已应用工作区约束的完整表名约定。"""
from alembic import op
revision: str = "07b8c9d0e1f2"
down_revision: str | None = "f6a708b9c0d1"
branch_labels = None
depends_on = None
RENAMES = (
("tplus_source_heads", "uk_tplus_heads_source_entity_id", "uk_tplus_source_heads_source_entity_id"),
("tplus_source_heads", "idx_tplus_heads_batch_entity", "idx_tplus_source_heads_batch_entity"),
("tplus_source_links", "uk_tplus_links_source_entity_id", "uk_tplus_source_links_source_entity_id"),
("tplus_source_links", "uk_tplus_links_entity_target", "uk_tplus_source_links_entity_target"),
)
def upgrade():
"""只重命名固定索引,不改变任何数据。"""
for table, old, new in RENAMES:
op.execute(f"ALTER TABLE {table} RENAME INDEX {old} TO {new}")
def downgrade():
"""恢复 V16 固定索引名。"""
for table, old, new in reversed(RENAMES):
op.execute(f"ALTER TABLE {table} RENAME INDEX {new} TO {old}")