Merge ~lgp171188/launchpad:add-locked-column-to-bug-table into launchpad:db-devel

Proposed by Guruprasad
Status: Merged
Approved by: Guruprasad
Approved revision: 39170af1528575fb35bb06c20ff3decb9b12f431
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~lgp171188/launchpad:add-locked-column-to-bug-table
Merge into: launchpad:db-devel
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
William Grant db Approve
Colin Watson (community) db Approve
Review via email: mp+413934@code.launchpad.net

Commit message

Add 'lock_status' field to Bug

This will be used to store the values of an enum containing the possible values.

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

I think I misread Colin's comment about this field.

> An enum is better than a boolean here, since for now we want "unlocked" and "comment-only" lock states, but it's conceivable that we might want others in future.

So I am updating the status to 'Work in progress' and no review is needed right now.

Revision history for this message
Guruprasad (lgp171188) wrote :

Updated the field to be an integer to store the values of an enum that will contain values for the various possible states.

Revision history for this message
Colin Watson (cjwatson) :
Revision history for this message
Guruprasad (lgp171188) :
Revision history for this message
Guruprasad (lgp171188) wrote :

I have pushed a new revision with the changes to address the review comments on the previous revision.

Revision history for this message
Colin Watson (cjwatson) :
Revision history for this message
Colin Watson (cjwatson) wrote :

LGTM, but adding William for a second DB review.

review: Approve (db)
Revision history for this message
Colin Watson (cjwatson) wrote :

As discussed on Mattermost, I think we probably additionally want a nullable text `lock_reason` column, so that it's possible for somebody to explain why they're locking a bug.

Revision history for this message
Guruprasad (lgp171188) wrote :

Colin, I have updated the patch to add a 'lock_reason' column.

Revision history for this message
Colin Watson (cjwatson) :
review: Approve (db)
Revision history for this message
Guruprasad (lgp171188) :
Revision history for this message
William Grant (wgrant) :
review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/database/schema/patch-2210-38-0.sql b/database/schema/patch-2210-38-0.sql
0new file mode 1006440new file mode 100644
index 0000000..eef88ec
--- /dev/null
+++ b/database/schema/patch-2210-38-0.sql
@@ -0,0 +1,24 @@
1-- Copyright 2022 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 Bug
7 ADD COLUMN lock_status integer,
8 ADD COLUMN lock_reason text;
9
10-- ALTER COLUMN ... SET DEFAULT doesn't trigger a table rewrite,
11-- while ADD COLUMN ... DEFAULT xx does. In pg <11 this operation is slow.
12-- That's why we first create, and then we set the default value.
13-- Data backfilling will be done in a garbo job instead of a fast downtime.
14
15ALTER TABLE Bug
16 ALTER COLUMN lock_status
17 -- 0 = UNLOCKED
18 SET DEFAULT 0;
19
20COMMENT ON COLUMN Bug.lock_status IS 'The current lock status of this bug.';
21
22COMMENT ON COLUMN Bug.lock_reason IS 'The reason for locking this bug.';
23
24INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 38, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: