Merge ~cjwatson/launchpad:db-built-using into launchpad:db-devel

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 43656977ae6adc4319c2f4617ff05e311f7963fe
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:db-built-using
Merge into: launchpad:db-devel
Diff against target: 31 lines (+25/-0)
1 file modified
database/schema/patch-2210-13-0.sql (+25/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Review via email: mp+381036@code.launchpad.net

Commit message

Add BinarySourceReference table

Description of the change

This will be used to implement the Built-Using field in archives.

The grants for ArchiveDependency are needed because anything that creates BinarySourceReference rows from package relationship fields ("source-package-name (= version)") needs to work out which SPR was actually used by the build. It's not clear how to do this completely unambiguously, but we can derive a good approximation by trying the build's archive dependencies in order. To support this, anything that creates BinarySourceReferences needs to be able to read ArchiveDependency.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

The permission changes (and corresponding commit message paragraph) feel like they would have fit better in the model branch, but looks good anyway.

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

OK, I've moved the permission changes over to the model branch, adjusted its commit message, and rebased that stack.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/database/schema/patch-2210-13-0.sql b/database/schema/patch-2210-13-0.sql
0new file mode 1006440new file mode 100644
index 0000000..0889468
--- /dev/null
+++ b/database/schema/patch-2210-13-0.sql
@@ -0,0 +1,25 @@
1-- Copyright 2020 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
6CREATE TABLE BinarySourceReference (
7 id serial PRIMARY KEY,
8 binary_package_release integer NOT NULL REFERENCES binarypackagerelease,
9 source_package_release integer NOT NULL REFERENCES sourcepackagerelease,
10 reference_type integer NOT NULL
11);
12
13COMMENT ON TABLE BinarySourceReference IS 'A reference from a binary package release to a source package release.';
14COMMENT ON COLUMN BinarySourceReference.binary_package_release IS 'The referencing binary package release.';
15COMMENT ON COLUMN BinarySourceReference.source_package_release IS 'The referenced source package release.';
16COMMENT ON COLUMN BinarySourceReference.reference_type IS 'The type of the reference.';
17
18CREATE INDEX binarysourcereference__bpr__type__idx
19 ON BinarySourceReference (binary_package_release, reference_type);
20CREATE INDEX binarysourcereference__spr__type__idx
21 ON BinarySourceReference (source_package_release, reference_type);
22CREATE UNIQUE INDEX binarysourcereference__bpr__spr__type__key
23 ON BinarySourceReference (binary_package_release, source_package_release, reference_type);
24
25INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 13, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: