~launchpad-pqm/launchpad/devel

7675.1128.1 by Gavin Panella
Database patch for new PackageCopyJob table.
1
-- Copyright 2011 Canonical Ltd.  This software is licensed under the
2
-- GNU Affero General Public License version 3 (see the file LICENSE).
3
4
SET client_min_messages=ERROR;
5
6
CREATE TABLE PackageCopyJob (
7
    id serial PRIMARY KEY,
8
    job integer NOT NULL CONSTRAINT packagecopyjob__job__fk REFERENCES job,
9
    source_archive integer NOT NULL REFERENCES Archive,
10
    target_archive integer NOT NULL REFERENCES Archive,
11
    target_distroseries integer REFERENCES DistroSeries,
12
    job_type integer NOT NULL,
13
    json_data text
14
);
15
16
ALTER TABLE PackageCopyJob
17
  ADD CONSTRAINT packagecopyjob__job__key UNIQUE (job);
18
CREATE INDEX packagecopyjob__source
19
  ON PackageCopyJob (source_archive);
20
CREATE INDEX packagecopyjob__target
21
  ON PackageCopyJob (target_archive, target_distroseries);
22
23
ALTER TABLE PackageUpload
24
  ADD COLUMN package_copy_job integer
25
    CONSTRAINT packageupload__package_copy_job__fk REFERENCES PackageCopyJob;
7675.1128.6 by Gavin Panella
Create an index on PackageUpload.package_copy_job as suggested by stub.
26
CREATE INDEX packageupload__package_copy_job__idx
27
  ON PackageUpload(package_copy_job)
28
    WHERE package_copy_job IS NOT NULL;
7675.1128.1 by Gavin Panella
Database patch for new PackageCopyJob table.
29
7675.1128.7 by Gavin Panella
Set the patch number.
30
INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 68, 0);