Merge lp:~cjwatson/launchpad/db-archive-index-by-hash into lp:launchpad/db-devel

Proposed by Colin Watson
Status: Merged
Merged at revision: 13370
Proposed branch: lp:~cjwatson/launchpad/db-archive-index-by-hash
Merge into: lp:launchpad/db-devel
Diff against target: 56 lines (+34/-0)
2 files modified
database/schema/patch-2209-74-0.sql (+32/-0)
database/schema/security.cfg (+2/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/db-archive-index-by-hash
Reviewer Review Type Date Requested Status
William Grant db Approve
Review via email: mp+289372@code.launchpad.net

Commit message

Add ArchiveFile table.

Description of the change

Add ArchiveFile table.

This lets us keep track of files that are published in an archive but that aren't part of a source or binary publication, such as index files. The immediate use of this will be to implement by-hash (hence the scheduled deletion date arrangements), but the same facility should also be useful as a step towards diskless archives.

To post a comment you must log in.
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
1=== added file 'database/schema/patch-2209-74-0.sql'
2--- database/schema/patch-2209-74-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-74-0.sql 2016-03-18 15:01:46 +0000
4@@ -0,0 +1,32 @@
5+-- Copyright 2016 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+CREATE TABLE ArchiveFile (
11+ id serial PRIMARY KEY,
12+ archive integer NOT NULL REFERENCES archive ON DELETE CASCADE,
13+ container text NOT NULL,
14+ path text NOT NULL,
15+ library_file integer NOT NULL REFERENCES libraryfilealias,
16+ scheduled_deletion_date timestamp without time zone
17+);
18+
19+COMMENT ON TABLE ArchiveFile IS 'A file in an archive.';
20+COMMENT ON COLUMN ArchiveFile.archive IS 'The archive containing the file.';
21+COMMENT ON COLUMN ArchiveFile.container IS 'An identifier for the component that manages this file.';
22+COMMENT ON COLUMN ArchiveFile.path IS 'The path to the file within the published archive.';
23+COMMENT ON COLUMN ArchiveFile.library_file IS 'The file in the librarian.';
24+COMMENT ON COLUMN ArchiveFile.scheduled_deletion_date IS 'The date when this file should stop being published.';
25+
26+CREATE INDEX archivefile__archive__container__idx
27+ ON ArchiveFile (archive, container);
28+CREATE INDEX archivefile__archive__scheduled_deletion_date__container__idx
29+ ON ArchiveFile (archive, scheduled_deletion_date, container)
30+ WHERE scheduled_deletion_date IS NOT NULL;
31+CREATE INDEX archivefile__archive__path__idx
32+ ON ArchiveFile (archive, path);
33+CREATE INDEX archivefile__library_file__idx
34+ ON ArchiveFile (library_file);
35+
36+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 74, 0);
37
38=== modified file 'database/schema/security.cfg'
39--- database/schema/security.cfg 2016-03-14 19:40:14 +0000
40+++ database/schema/security.cfg 2016-03-18 15:01:46 +0000
41@@ -129,6 +129,7 @@
42 public.archivearch = SELECT, INSERT, UPDATE, DELETE
43 public.archiveauthtoken = SELECT, INSERT, UPDATE
44 public.archivedependency = SELECT, INSERT, DELETE
45+public.archivefile = SELECT, INSERT, UPDATE, DELETE
46 public.archivejob = SELECT, INSERT, UPDATE, DELETE
47 public.archivepermission = SELECT, INSERT, UPDATE, DELETE
48 public.archivesubscriber = SELECT, INSERT, UPDATE
49@@ -880,6 +881,7 @@
50 public.archive = SELECT, UPDATE
51 public.archivearch = SELECT
52 public.archiveauthtoken = SELECT, UPDATE
53+public.archivefile = SELECT, INSERT, UPDATE, DELETE
54 public.archivepermission = SELECT, INSERT
55 public.archivesubscriber = SELECT, UPDATE
56 public.binarypackagepublishinghistory = SELECT, INSERT, UPDATE, DELETE

Subscribers

People subscribed via source and target branches

to status/vote changes: