launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27935
Re: [Merge] ~lgp171188/launchpad:add-locked-column-to-bug-table into launchpad:db-devel
Diff comments:
> diff --git a/database/schema/patch-2210-38-0.sql b/database/schema/patch-2210-38-0.sql
> new file mode 100644
> index 0000000..fca2fec
> --- /dev/null
> +++ b/database/schema/patch-2210-38-0.sql
> @@ -0,0 +1,18 @@
> +-- Copyright 2022 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 Bug
> + ADD COLUMN locked INTEGER;
"locked" still sounds rather like a boolean. Could we make this something like "lock_status"?
> +
> +-- 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.
The backfill should probably be in a garbo job rather than a hot patch.
> +
> +ALTER TABLE Bug ALTER COLUMN locked SET DEFAULT 1;
It obviously doesn't make a functional difference, but personally I'd find it less confusing if the default unlocked state had the value 0 rather than 1.
Also, when we use enum values in SQL, we normally add a comment with the corresponding symbolic name, e.g. from `database/schema/patch-2210-33-0.sql`:
CREATE INDEX charmrecipebuild__recipe__das__status__finished__idx
ON CharmRecipeBuild (recipe, distro_arch_series, status, date_finished DESC)
-- 1 == FULLYBUILT
WHERE status = 1;
> +
> +COMMENT ON COLUMN Bug.locked IS 'The current lock status of this bug.';
> +
> +INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 38, 0);
--
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/413934
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:add-locked-column-to-bug-table into launchpad:db-devel.
References