feat: 归档旧迁移文件,创建初始化数据迁移和重置脚本
This commit is contained in:
22
migrations/archive/000069_add_order_expiration.down.sql
Normal file
22
migrations/archive/000069_add_order_expiration.down.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- 回滚:删除订单过期时间索引和字段
|
||||
DO $$
|
||||
BEGIN
|
||||
-- 删除复合索引
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM pg_indexes
|
||||
WHERE tablename='tb_order'
|
||||
AND indexname='idx_order_expires'
|
||||
) THEN
|
||||
DROP INDEX idx_order_expires;
|
||||
END IF;
|
||||
|
||||
-- 删除 expires_at 字段
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name='tb_order'
|
||||
AND column_name='expires_at'
|
||||
) THEN
|
||||
ALTER TABLE tb_order DROP COLUMN expires_at;
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
Reference in New Issue
Block a user