chore: drop legacy auth.users fks blocking Logto users

This commit is contained in:
2026-09-02 13:44:06 +00:00
parent f27610df97
commit 8413cf64a9
@@ -0,0 +1,14 @@
DO $$
DECLARE
r RECORD;
BEGIN
FOR r IN (
SELECT conrelid::regclass AS table_name, conname AS constraint_name
FROM pg_constraint
WHERE confrelid = 'auth.users'::regclass
AND conrelid::regclass::text LIKE '"TS_ERP"%'
) LOOP
EXECUTE 'ALTER TABLE ' || r.table_name || ' DROP CONSTRAINT IF EXISTS ' || r.constraint_name || ' CASCADE;';
RAISE NOTICE 'Dropped constraint % on %', r.constraint_name, r.table_name;
END LOOP;
END $$;