launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24908
[Merge] ~pappacena/launchpad:merge-db-stable into launchpad:master
Thiago F. Pappacena has proposed merging ~pappacena/launchpad:merge-db-stable into launchpad:master.
Commit message:
Merge db-stable 9b0e0a8303b913dd6ba56af663e5e3df8c8dcdac (Add GitRepository.status column)
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/386441
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/launchpad:merge-db-stable into launchpad:master.
diff --git a/database/schema/patch-2210-17-0.sql b/database/schema/patch-2210-17-0.sql
new file mode 100644
index 0000000..3f5946a
--- /dev/null
+++ b/database/schema/patch-2210-17-0.sql
@@ -0,0 +1,17 @@
+-- Copyright 2020 Canonical Ltd. This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+ALTER TABLE GitRepository ADD COLUMN status INTEGER;
+
+-- ALTER COLUMN ... SET DEFAULT doesn't trigger a table rewrite,
+-- while ADD COLUMN ... DEFAULT xx does. In pg <11 this operation is slow.
+-- That's why we first create, and then we set the default value.
+-- Data backfilling will be done in a hot patch instead of a fast downtime.
+ALTER TABLE GitRepository ALTER COLUMN status SET DEFAULT 2;
+
+COMMENT ON COLUMN GitRepository.status
+ IS 'The current status of this git repository.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 17, 0);