新增資料庫架構

This commit is contained in:
2025-07-19 02:12:37 +08:00
parent e3832acfa8
commit 924f03c3d7
45 changed files with 12858 additions and 324 deletions

View File

@@ -0,0 +1,26 @@
-- 修復 migration_log 表的約束問題
-- 允許 'storage_cleanup' 和 'data_cleanup' 類型
BEGIN;
-- 移除舊的約束
ALTER TABLE migration_log DROP CONSTRAINT IF EXISTS migration_log_migration_type_check;
-- 添加新的約束,包含所有需要的類型
ALTER TABLE migration_log ADD CONSTRAINT migration_log_migration_type_check
CHECK (migration_type IN ('wishes', 'likes', 'settings', 'storage_cleanup', 'data_cleanup', 'image_cleanup'));
-- 顯示結果
DO $$
BEGIN
RAISE NOTICE '✅ migration_log 表約束已更新';
RAISE NOTICE '📋 允許的 migration_type 值:';
RAISE NOTICE ' - wishes困擾案例遷移';
RAISE NOTICE ' - likes點讚記錄遷移';
RAISE NOTICE ' - settings用戶設定遷移';
RAISE NOTICE ' - storage_cleanup存儲清理';
RAISE NOTICE ' - data_cleanup數據清空';
RAISE NOTICE ' - image_cleanup圖片清理';
END $$;
COMMIT;