| | |
| | | -- Ticket12:人工结束关闭全部开放接收区间,并为顺序接入保留稳定的来源时间索引。 |
| | | -- DDL 使用 information_schema 守卫,便于已迁移开发库重复启动时安全执行。 |
| | | SET @boundary_constraint_sql := ( |
| | | SELECT IF(COUNT(*) = 0, |
| | | 'ALTER TABLE t_test_reception_interval ADD CONSTRAINT chk_reception_interval_boundary_order CHECK (end_boundary_at_utc IS NULL OR end_boundary_at_utc >= start_boundary_at_utc)', |
| | | 'SELECT 1') |
| | | FROM information_schema.table_constraints |
| | | WHERE constraint_schema = DATABASE() |
| | | AND table_name = 't_test_reception_interval' |
| | | AND constraint_name = 'chk_reception_interval_boundary_order'); |
| | | PREPARE boundary_constraint_stmt FROM @boundary_constraint_sql; |
| | | EXECUTE boundary_constraint_stmt; |
| | | DEALLOCATE PREPARE boundary_constraint_stmt; |
| | | ALTER TABLE t_test_reception_interval |
| | | ADD CONSTRAINT chk_reception_interval_boundary_order |
| | | CHECK (end_boundary_at_utc IS NULL OR end_boundary_at_utc >= start_boundary_at_utc), |
| | | ADD KEY idx_reception_interval_source_order |
| | | (source_type, source_id, source_channel_code, start_boundary_at_utc, interval_id); |
| | | |
| | | SET @source_order_index_sql := ( |
| | | SELECT IF(COUNT(*) = 0, |
| | | 'ALTER TABLE t_test_reception_interval ADD KEY idx_reception_interval_source_order (source_type, source_id, source_channel_code, start_boundary_at_utc, interval_id)', |
| | | 'SELECT 1') |
| | | FROM information_schema.statistics |
| | | WHERE table_schema = DATABASE() |
| | | AND table_name = 't_test_reception_interval' |
| | | AND index_name = 'idx_reception_interval_source_order'); |
| | | PREPARE source_order_index_stmt FROM @source_order_index_sql; |
| | | EXECUTE source_order_index_stmt; |
| | | DEALLOCATE PREPARE source_order_index_stmt; |
| | | |
| | | -- 停止测试权限由 V16 提供;此处保留权限插入的幂等保护。 |
| | | -- 停止测试权限由 V16 提供;这里仅保留迁移可重复启动所需的幂等保护。 |
| | | SET @stop_menu_id := (SELECT COALESCE(MAX(menu_id), 0) + 1 FROM sys_menu); |
| | | INSERT INTO sys_menu |
| | | (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, |