launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31151
[Merge] ~ines-almeida/launchpad:db-snap-pro-enable-constraints into launchpad:db-devel
Ines Almeida has proposed merging ~ines-almeida/launchpad:db-snap-pro-enable-constraints into launchpad:db-devel.
Commit message:
db: update snp.pro_enable schema change to add default false statement
This is relevant so that there is never a time that the value is NULL while creating the snap, which is scenario that can happen while setting the multiple snap fields when creating a new snap - if snap.pro_enable is set after snap.branch (which runs a validator that accesses the DB), then the null constraint will fail because snap.pro_enable is null (instead of false).
This change prevents any of such issues.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/467136
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:db-snap-pro-enable-constraints into launchpad:db-devel.
diff --git a/database/schema/patch-2211-24-0.sql b/database/schema/patch-2211-24-0.sql
index cb27abb..90e16f7 100644
--- a/database/schema/patch-2211-24-0.sql
+++ b/database/schema/patch-2211-24-0.sql
@@ -4,6 +4,7 @@
SET client_min_messages=ERROR;
ALTER TABLE Snap
+ ALTER COLUMN pro_enable SET DEFAULT false,
ALTER COLUMN pro_enable SET NOT NULL;
INSERT INTO LaunchpadDatabaseRevision VALUES (2211, 24, 0);
Follow ups