~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/schema/patch-2208-64-0.sql

  • Committer: Steve Kowalik
  • Date: 2011-05-09 09:06:12 UTC
  • mto: (7675.1045.340 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13163.
  • Revision ID: stevenk@ubuntu.com-20110509090612-astbrypfdyno40gx
Update existing DSDs to use parent_series for Ubuntu only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
SET client_min_messages=ERROR;
4
4
 
5
5
ALTER TABLE DistroSeriesDifference
6
 
    ADD COLUMN parent_series INTEGER NOT NULL
 
6
    ADD COLUMN parent_series INTEGER
7
7
        CONSTRAINT distroseriesdifference__parentseries__fk REFERENCES distroseries;
 
8
-- Because of the likelyhood of staging and production having existing data,
 
9
-- we need to set it, but only for Ubuntu.
 
10
UPDATE DistroSeriesDifference SET parent_series = (SELECT id from DistroSeries WHERE name = 'sid') FROM Distribution, DistroSeries WHERE Distribution.name = 'ubuntu' AND DistroSeries.id = derived_series AND DistroSeries.distribution = Distribution.id;
 
11
ALTER TABLE DistroSeriesDifference ALTER COLUMN parent_series SET NOT NULL;
8
12
 
9
13
CREATE INDEX distroseriesdifference__parent_series__idx ON DistroSeriesDifference(parent_series);
10
14