diff --git a/src/db/migrations/000009 - null-user-agreement.sql b/src/db/migrations/000009 - null-user-agreement.sql new file mode 100644 index 0000000..b603528 --- /dev/null +++ b/src/db/migrations/000009 - null-user-agreement.sql @@ -0,0 +1,11 @@ +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 $$; \ No newline at end of file