Merge lp:~james-w/launchpad/archive-job-db into lp:launchpad/db-devel

Proposed by James Westby
Status: Merged
Approved by: Stuart Bishop
Approved revision: no longer in the source branch.
Merged at revision: 9586
Proposed branch: lp:~james-w/launchpad/archive-job-db
Merge into: lp:launchpad/db-devel
Prerequisite: lp:~james-w/launchpad/test-package-cloner
Diff against target: 118 lines (+56/-0)
5 files modified
database/sampledata/current-dev.sql (+10/-0)
database/sampledata/current.sql (+10/-0)
database/schema/comments.sql (+8/-0)
database/schema/patch-2207-64-0.sql (+27/-0)
database/schema/security.cfg (+1/-0)
To merge this branch: bzr merge lp:~james-w/launchpad/archive-job-db
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Robert Collins db Pending
Björn Tillenius db Pending
Review via email: mp+28437@code.launchpad.net

Commit message

Add an ArchiveJob table.

Description of the change

Hi,

This adds an ArchiveJob, like BranchJob and BugJob.

The first use is for copy archive jobs, that currently aren't jobs
but should be. I expect there will be more uses in the future.

Thanks,

James

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

You can see the model classes at

  https://code.edge.launchpad.net/~james-w/launchpad/copy-archive-job/+merge/28439

with some more description of the aim of this job type.

Thanks,

James

Revision history for this message
Stuart Bishop (stub) wrote :

Generally fine.

patch-2207-64-0.sql

I think the job foreign key constraint should be ON DELETE CASCADE to make job garbage collection a little easier:

job integer NOT NULL CONSTRAINT archivejob__job__fk REFERENCES job ON DELETE CASCADE

(the archive foriegn key constraint should not be).

Revision history for this message
Stuart Bishop (stub) :
review: Approve (db)
Revision history for this message
Stuart Bishop (stub) wrote :

Oh... please fix the security.cfg declarations. The [write] section is deprecated per the comments. Please add explicit permissions to users.

Revision history for this message
James Westby (james-w) wrote :

On Fri, 25 Jun 2010 07:41:28 -0000, Stuart Bishop <email address hidden> wrote:
> Oh... please fix the security.cfg declarations. The [write] section is deprecated per the comments. Please add explicit permissions to users.

I was just cargo-culting, so I'm not surprised it is wrong.

I guess the other permission is ok?

I don't know what explicit permissions other than that would be needed.

Currently these jobs would be added by a script run by an admin on
request, and then we will add a cronscript to process them. If you can
tell me what users/permission might be needed for that then I can add
them now, otherwise I will just leave the default in and work with the
Soyuz team on making other changes needed once we have something to test
on dogfood.

Thanks,

James

Revision history for this message
Stuart Bishop (stub) wrote :

No problems - the permissions can be added when the cronscript or whatever processes the jobs is written.

Revision history for this message
James Westby (james-w) wrote :

Hi Stuart,

Could you give this another look over as I have made the changes you suggested?

Thanks,

James

Revision history for this message
Stuart Bishop (stub) wrote :

Looks good

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql 2010-07-28 14:36:32 +0000
+++ database/sampledata/current-dev.sql 2010-07-28 17:45:50 +0000
@@ -791,6 +791,9 @@
791791
792792
793793
794
795
796
794SET SESSION AUTHORIZATION DEFAULT;797SET SESSION AUTHORIZATION DEFAULT;
795798
796ALTER TABLE account DISABLE TRIGGER ALL;799ALTER TABLE account DISABLE TRIGGER ALL;
@@ -2207,6 +2210,13 @@
2207ALTER TABLE archivedependency ENABLE TRIGGER ALL;2210ALTER TABLE archivedependency ENABLE TRIGGER ALL;
22082211
22092212
2213ALTER TABLE archivejob DISABLE TRIGGER ALL;
2214
2215
2216
2217ALTER TABLE archivejob ENABLE TRIGGER ALL;
2218
2219
2210ALTER TABLE packagesetgroup DISABLE TRIGGER ALL;2220ALTER TABLE packagesetgroup DISABLE TRIGGER ALL;
22112221
22122222
22132223
=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql 2010-07-28 14:36:32 +0000
+++ database/sampledata/current.sql 2010-07-28 17:45:50 +0000
@@ -791,6 +791,9 @@
791791
792792
793793
794
795
796
794SET SESSION AUTHORIZATION DEFAULT;797SET SESSION AUTHORIZATION DEFAULT;
795798
796ALTER TABLE account DISABLE TRIGGER ALL;799ALTER TABLE account DISABLE TRIGGER ALL;
@@ -2164,6 +2167,13 @@
2164ALTER TABLE archivedependency ENABLE TRIGGER ALL;2167ALTER TABLE archivedependency ENABLE TRIGGER ALL;
21652168
21662169
2170ALTER TABLE archivejob DISABLE TRIGGER ALL;
2171
2172
2173
2174ALTER TABLE archivejob ENABLE TRIGGER ALL;
2175
2176
2167ALTER TABLE packagesetgroup DISABLE TRIGGER ALL;2177ALTER TABLE packagesetgroup DISABLE TRIGGER ALL;
21682178
21692179
21702180
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2010-07-23 19:47:16 +0000
+++ database/schema/comments.sql 2010-07-28 17:45:50 +0000
@@ -29,6 +29,14 @@
29COMMENT ON COLUMN ApportJob.job_type IS 'The type of job (enumeration value). Allows us to query the database for a given subset of ApportJobs.';29COMMENT ON COLUMN ApportJob.job_type IS 'The type of job (enumeration value). Allows us to query the database for a given subset of ApportJobs.';
30COMMENT ON COLUMN ApportJob.json_data IS 'A JSON struct containing data for the job.';30COMMENT ON COLUMN ApportJob.json_data IS 'A JSON struct containing data for the job.';
3131
32-- ArchiveJob
33
34COMMENT ON TABLE ArchiveJob is 'Contains references to jobs to be run against Archives.';
35COMMENT ON COLUMN ArchiveJob.archive IS 'The archive on which the job is to be run.';
36COMMENT ON COLUMN ArchiveJob.job_type IS 'The type of job (enumeration value). Allows us to query the database for a given subset of ArchiveJobs.';
37COMMENT ON COLUMN ArchiveJob.json_data IS 'A JSON struct containing data for the job.';
38
39
32-- Branch40-- Branch
33COMMENT ON TABLE Branch IS 'Bzr branch';41COMMENT ON TABLE Branch IS 'Bzr branch';
34COMMENT ON COLUMN Branch.registrant IS 'The user that registered the branch.';42COMMENT ON COLUMN Branch.registrant IS 'The user that registered the branch.';
3543
=== added file 'database/schema/patch-2207-64-0.sql'
--- database/schema/patch-2207-64-0.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2207-64-0.sql 2010-07-28 17:45:50 +0000
@@ -0,0 +1,27 @@
1-- Copyright 2009 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
6-- The schema patch required for adding archive jobs, the first being
7-- creation of copy archives.
8
9-- The `ArchiveJob` table captures the data required for an archive job.
10
11CREATE TABLE ArchiveJob (
12 id serial PRIMARY KEY,
13 -- FK to the `Job` record with the "generic" data about this archive
14 -- job.
15 job integer NOT NULL CONSTRAINT archivejob__job__fk REFERENCES job ON DELETE CASCADE,
16 -- FK to the associated `Archive` record.
17 archive integer NOT NULL CONSTRAINT archivejob__archive__fk REFERENCES archive,
18 -- The particular type of archive job
19 job_type integer NOT NULL,
20 -- JSON data for use by the job
21 json_data text
22);
23
24ALTER TABLE ArchiveJob ADD CONSTRAINT archivejob__job__key UNIQUE (job);
25CREATE INDEX archivejob__archive__job_type__idx ON ArchiveJob(archive, job_type);
26
27INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 64, 0);
028
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-07-28 14:36:32 +0000
+++ database/schema/security.cfg 2010-07-28 17:45:50 +0000
@@ -82,6 +82,7 @@
82public.apportjob = SELECT, INSERT, UPDATE, DELETE82public.apportjob = SELECT, INSERT, UPDATE, DELETE
83public.archive = SELECT, INSERT, UPDATE83public.archive = SELECT, INSERT, UPDATE
84public.archiveauthtoken = SELECT, INSERT, UPDATE84public.archiveauthtoken = SELECT, INSERT, UPDATE
85public.archivejob = SELECT, INSERT, UPDATE, DELETE
85public.archivesubscriber = SELECT, INSERT, UPDATE86public.archivesubscriber = SELECT, INSERT, UPDATE
86public.archivearch = SELECT, INSERT, UPDATE, DELETE87public.archivearch = SELECT, INSERT, UPDATE, DELETE
87public.archivedependency = SELECT, INSERT, DELETE88public.archivedependency = SELECT, INSERT, DELETE

Subscribers

People subscribed via source and target branches

to status/vote changes: