← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pappacena/launchpad:not-valid-on-gitrepo-constraint-migration into launchpad:db-devel

 

Thiago F. Pappacena has proposed merging ~pappacena/launchpad:not-valid-on-gitrepo-constraint-migration into launchpad:db-devel.

Commit message:
Moving CHECK constraint validation to a hot patch, instead of doing it in the "fast downtime" workflow.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/385005
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/launchpad:not-valid-on-gitrepo-constraint-migration into launchpad:db-devel.
diff --git a/database/schema/patch-2210-08-8.sql b/database/schema/patch-2210-08-8.sql
index dffbaac..5a20873 100644
--- a/database/schema/patch-2210-08-8.sql
+++ b/database/schema/patch-2210-08-8.sql
@@ -35,12 +35,14 @@ ALTER TABLE GitRepository
         -- OCI project
         (project IS NULL AND distribution IS NULL AND sourcepackagename IS NULL AND oci_project IS NOT NULL AND ociprojectname IS NULL) OR
         -- Personal
-        (project IS NULL AND distribution IS NULL AND sourcepackagename IS NULL AND oci_project IS NULL)),
+        (project IS NULL AND distribution IS NULL AND sourcepackagename IS NULL AND oci_project IS NULL))
+        NOT VALID,
     DROP CONSTRAINT default_implies_target,
     ADD CONSTRAINT default_implies_target CHECK (
         project IS NOT NULL
         OR distribution IS NOT NULL
         OR oci_project IS NOT NULL
-        OR (NOT owner_default AND NOT target_default));
+        OR (NOT owner_default AND NOT target_default))
+        NOT VALID;
 
 INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 8, 8);