Merge ~pappacena/launchpad:ocirecipe-private-dbpatch-indexes into launchpad:master

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: 1a93507e4e735e91a519ab14474c9b4cc2acca2b
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/launchpad:ocirecipe-private-dbpatch-indexes
Merge into: launchpad:master
Prerequisite: ~pappacena/launchpad:ocirecipe-private-dbpatch
Diff against target: 18 lines (+12/-0)
1 file modified
database/schema/patch-2210-26-4.sql (+12/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Colin Watson Approve
Review via email: mp+399243@code.launchpad.net

Commit message

Adding index and checking constraint for private OCI recipe database changes.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Colin Watson (cjwatson) wrote :

Adding William for a second DB review.

Revision history for this message
William Grant (wgrant) :
review: Approve (db)
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-26-4.sql b/database/schema/patch-2210-26-4.sql
2new file mode 100644
3index 0000000..cc1553c
4--- /dev/null
5+++ b/database/schema/patch-2210-26-4.sql
6@@ -0,0 +1,12 @@
7+-- Copyright 2021 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+CREATE UNIQUE INDEX accessartifact__ocirecipe__key
13+ ON AccessArtifact(ocirecipe) WHERE ocirecipe IS NOT NULL;
14+
15+ALTER TABLE AccessArtifact VALIDATE CONSTRAINT has_artifact;
16+
17+
18+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 26, 4);