Merge ~pappacena/launchpad:merge-db-stable into launchpad:master

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: b7df45fb16d11aab10677be8bf085aee312711a0
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/launchpad:merge-db-stable
Merge into: launchpad:master
Diff against target: 23 lines (+17/-0)
1 file modified
database/schema/patch-2210-17-0.sql (+17/-0)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+386441@code.launchpad.net

Commit message

Merge db-stable 9b0e0a8303b913dd6ba56af663e5e3df8c8dcdac (Add GitRepository.status column)

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

Deployed to the production database today.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/database/schema/patch-2210-17-0.sql b/database/schema/patch-2210-17-0.sql
0new file mode 1006440new file mode 100644
index 0000000..3f5946a
--- /dev/null
+++ b/database/schema/patch-2210-17-0.sql
@@ -0,0 +1,17 @@
1-- Copyright 2020 Canonical Ltd. This software is licensed under the
2-- GNU Affero General Public License version 3 (see the file LICENSE).
3
4SET client_min_messages=ERROR;
5
6ALTER TABLE GitRepository ADD COLUMN status INTEGER;
7
8-- ALTER COLUMN ... SET DEFAULT doesn't trigger a table rewrite,
9-- while ADD COLUMN ... DEFAULT xx does. In pg <11 this operation is slow.
10-- That's why we first create, and then we set the default value.
11-- Data backfilling will be done in a hot patch instead of a fast downtime.
12ALTER TABLE GitRepository ALTER COLUMN status SET DEFAULT 2;
13
14COMMENT ON COLUMN GitRepository.status
15 IS 'The current status of this git repository.';
16
17INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 17, 0);