| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- -- ============================================================
- -- 拆表收尾:删除旧表 app_user.drainage_engineering_facility
- --
- -- 前置条件(务必全部满足后再执行):
- -- 1. migration_infrastructure_restructure.sql 已执行,新表存在:
- -- app_user.drainage_gate_info
- -- app_user.drainage_storage_info
- -- app_user.pump_station_info
- -- 2. 后端新代码已上线:
- -- /api/drainage/gate/* → drainage_gate_info
- -- /api/drainage/storage/* → drainage_storage_info
- -- /api/drainage/pumpStation/* → pump_station_info(station_type=drainage)
- -- 3. 前端已切接口,驾驶舱已切 Mapper。
- --
- -- 注意:
- -- · 本脚本【不迁移历史数据】(按本次约束)。旧表 drop 后,
- -- 拆表前录入的闸门/调蓄/泵站台账将不再可见,新表从空表开始。
- -- · 删除不可逆,执行前请确认旧表无保留价值。
- -- ============================================================
- -- 前置:结束上一次失败执行遗留的 aborted 事务
- ROLLBACK;
- BEGIN;
- SET search_path TO app_user, public;
- -- 核对新表是否就绪(若任一行返回 0,请终止本脚本)
- SELECT count(*) AS new_table_count
- FROM information_schema.tables
- WHERE table_schema = 'app_user'
- AND table_name IN ('drainage_gate_info', 'drainage_storage_info', 'pump_station_info');
- -- 期望 new_table_count = 3
- -- 删除旧表
- DROP TABLE IF EXISTS app_user.drainage_engineering_facility;
- COMMIT;
- -- 核对:旧表应不存在
- -- SELECT count(*) FROM information_schema.tables
- -- WHERE table_schema='app_user' AND table_name='drainage_engineering_facility';
- -- 期望 0
|