迁移去重与改号:消除与 main 的 000050-053 撞号

- 删除 dev 的 000051_user_token_version(main 的 000052_user_token_version 已实现同列)
- order_list_least_privilege / file_upload_owners / cleanup_index 改号为 000067-000069
- 000068 改为 CREATE TABLE IF NOT EXISTS、000069 改为条件加索引,兼容已执行旧编号的历史库
This commit is contained in:
yml2213
2026-09-05 11:54:53 +08:00
parent 369b0647bb
commit 0c37c7e659
5 changed files with 22 additions and 21 deletions
@@ -0,0 +1,21 @@
-- +goose Up
-- 为长期未关联上传归属记录的定时清理提供索引。
-- 兼容历史上已按旧编号执行过该索引的数据库,重复执行时跳过。
SET @idx_exists := (
SELECT COUNT(*) FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = 'file_upload_owners'
AND index_name = 'idx_file_upload_owners_created_at'
);
SET @ddl := IF(@idx_exists > 0,
'SELECT 1',
'ALTER TABLE file_upload_owners ADD KEY idx_file_upload_owners_created_at (created_at)');
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- +goose Down
ALTER TABLE file_upload_owners
DROP INDEX idx_file_upload_owners_created_at;