Files
jlinc-server/backend/db/migrations/000009 - null-user-agreement.sql
2026-08-20 15:08:32 +00:00

11 lines
269 B
SQL

DO $$ BEGIN
IF EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_name = 'agreement'
AND column_name = 'user_id'
AND is_nullable = 'NO'
) THEN
EXECUTE 'ALTER TABLE agreement ALTER COLUMN user_id DROP NOT NULL';
END IF;
END $$;