From ea8c9cc7666ac650f97bfca2285893c3b5c8d596 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 16 Oct 2025 21:29:44 +0000 Subject: [PATCH] remove safety migration --- ...nstance_settings_safety_migration.down.sql | 0 ..._instance_settings_safety_migration.up.sql | 27 ------------------- 2 files changed, 27 deletions(-) delete mode 100644 backend/migrations/20251006143821_ducklake_instance_settings_safety_migration.down.sql delete mode 100644 backend/migrations/20251006143821_ducklake_instance_settings_safety_migration.up.sql diff --git a/backend/migrations/20251006143821_ducklake_instance_settings_safety_migration.down.sql b/backend/migrations/20251006143821_ducklake_instance_settings_safety_migration.down.sql deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/backend/migrations/20251006143821_ducklake_instance_settings_safety_migration.up.sql b/backend/migrations/20251006143821_ducklake_instance_settings_safety_migration.up.sql deleted file mode 100644 index 05a111edfd..0000000000 --- a/backend/migrations/20251006143821_ducklake_instance_settings_safety_migration.up.sql +++ /dev/null @@ -1,27 +0,0 @@ --- Copy of 20250731132157_ducklake_instance_settings.up.sql --- Pushing a instance_settings.yaml without ducklake_user_pg_pwd will remove it from the global settings --- And the next migration will fail because it will try to insert a NULL value - -INSERT INTO global_settings (name, value) -VALUES ('ducklake_user_pg_pwd', ('"' || gen_random_uuid()::text || '"')::jsonb) -ON CONFLICT DO NOTHING; - --- Cannot simply create the user because Postgres expect a static string for the password --- Also we cannot drop the user easily in the down migration because databases will depend on it --- And we cannot drop databases in transactions (migrations) - -DO $$ -DECLARE - pwd text; -BEGIN - SELECT trim(both '"' from value::text) INTO pwd FROM global_settings WHERE name = 'ducklake_user_pg_pwd'; - IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'ducklake_user') THEN - EXECUTE format('CREATE USER ducklake_user WITH PASSWORD %L', pwd); - ELSE - EXECUTE format('ALTER USER ducklake_user WITH PASSWORD %L', pwd); - END IF; -EXCEPTION - WHEN others THEN - RAISE NOTICE 'ducklake_user migration error, skipping.'; -END -$$; \ No newline at end of file