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

Proposed by Guruprasad
Status: Merged
Approved by: Guruprasad
Approved revision: 96f81be7d884373624d09b67e040db0adb3f2177
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~lgp171188/launchpad:merge-db-stable
Merge into: launchpad:master
Diff against target: 30 lines (+24/-0)
1 file modified
database/schema/patch-2210-38-0.sql (+24/-0)
Reviewer Review Type Date Requested Status
Guruprasad Approve
Review via email: mp+414414@code.launchpad.net

Commit message

Merge 'db-stable' 7ab4bd7a744a92db22cf372769485eb5930c7a44

Add 'lock_status' and 'lock_reason' fields to Bug

To post a comment you must log in.
Revision history for this message
Guruprasad (lgp171188) wrote :

Self-approving because this change has already been deployed to production via the db-stable branch and verified to work okay.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-38-0.sql b/database/schema/patch-2210-38-0.sql
2new file mode 100644
3index 0000000..eef88ec
4--- /dev/null
5+++ b/database/schema/patch-2210-38-0.sql
6@@ -0,0 +1,24 @@
7+-- Copyright 2022 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
9+
10+SET client_min_messages=ERROR;
11+
12+ALTER TABLE Bug
13+ ADD COLUMN lock_status integer,
14+ ADD COLUMN lock_reason text;
15+
16+-- ALTER COLUMN ... SET DEFAULT doesn't trigger a table rewrite,
17+-- while ADD COLUMN ... DEFAULT xx does. In pg <11 this operation is slow.
18+-- That's why we first create, and then we set the default value.
19+-- Data backfilling will be done in a garbo job instead of a fast downtime.
20+
21+ALTER TABLE Bug
22+ ALTER COLUMN lock_status
23+ -- 0 = UNLOCKED
24+ SET DEFAULT 0;
25+
26+COMMENT ON COLUMN Bug.lock_status IS 'The current lock status of this bug.';
27+
28+COMMENT ON COLUMN Bug.lock_reason IS 'The reason for locking this bug.';
29+
30+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 38, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: