launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28319
[Merge] ~cjwatson/launchpad:merge-db-stable into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:merge-db-stable into launchpad:master.
Commit message:
Merge db-stable 485fc1f2d2 (Add date_created to RevisionStatusArtifact)
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/419042
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:merge-db-stable into launchpad:master.
diff --git a/database/schema/patch-2210-37-1.sql b/database/schema/patch-2210-37-1.sql
new file mode 100644
index 0000000..bddee9d
--- /dev/null
+++ b/database/schema/patch-2210-37-1.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 RevisionStatusArtifact
+ ADD COLUMN date_created timestamp without time zone DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL;
+
+UPDATE RevisionStatusArtifact
+SET date_created = LibraryFileAlias.date_created
+FROM LibraryFileAlias
+WHERE RevisionStatusArtifact.library_file = LibraryFileAlias.id;
+
+CREATE INDEX revisionstatusartifact__report__type__created__idx
+ ON RevisionStatusArtifact (report, type, date_created DESC);
+DROP INDEX revisionstatusartifact__report__type__idx;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 37, 1);