Files
windmill/backend/migrations/20260716152346_custom_instance_replication_user.down.sql
Diego Imbert 68daed8501 refactor: custom-instance datatable connection handling (#10271)
Attach custom-instance datatables in the DuckDB executor through a DuckDB
secret instead of an inline connection string, and route postgres triggers on
custom-instance datatables through a dedicated custom_instance_replication_user
role (with its own auto-generated password in global_settings). Normalize
custom_instance_user attributes on server boot.


Claude-Session: https://claude.ai/code/session_01Tp6NNNinCB8dwWqGaFXDRF

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 18:57:31 +02:00

15 lines
439 B
SQL

DO $$
BEGIN
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'custom_instance_user') THEN
ALTER ROLE custom_instance_user REPLICATION;
END IF;
DROP ROLE IF EXISTS custom_instance_replication_user;
DELETE FROM global_settings WHERE name = 'custom_instance_replication_pwd';
EXCEPTION
WHEN others THEN
RAISE NOTICE 'custom_instance_replication_user down-migration error, skipping: %', SQLERRM;
END
$$;