From 2c0af8e2374fd0d5a6582cab5466baea11caa0ce Mon Sep 17 00:00:00 2001 From: JlincFM Date: Mon, 13 Oct 2025 12:53:39 +0000 Subject: [PATCH] remove null requirement on agreement content --- src/db/migrations/000009 - null-user-agreement.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/db/migrations/000009 - null-user-agreement.sql 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