From cd384a585e783e8aa582cea492d3d5180081ec3f Mon Sep 17 00:00:00 2001 From: amandine-sahl Date: Tue, 5 Nov 2024 17:44:29 +0100 Subject: [PATCH] Add not valid to check contraints --- .../8b149244d586_add_required_conditions_in_import.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py b/backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py index ba99791038..70f77041b5 100644 --- a/backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py +++ b/backend/geonature/migrations/versions/8b149244d586_add_required_conditions_in_import.py @@ -66,14 +66,16 @@ def upgrade(): op.execute( """ - alter table gn_imports.bib_fields - ADD CONSTRAINT mandatory_conditions_field_exists CHECK (gn_imports.isInNameFields(mandatory_conditions,id_destination)); + ALTER TABLE gn_imports.bib_fields + ADD CONSTRAINT mandatory_conditions_field_exists CHECK (gn_imports.isInNameFields(mandatory_conditions,id_destination)) + NOT VALID; """ ) op.execute( """ - alter table gn_imports.bib_fields - ADD CONSTRAINT optional_conditions_field_exists CHECK (gn_imports.isInNameFields(optional_conditions,id_destination)); + ALTER TABLE gn_imports.bib_fields + ADD CONSTRAINT optional_conditions_field_exists CHECK (gn_imports.isInNameFields(optional_conditions,id_destination)) + NOT VALID; """ ) conn = op.get_bind()