~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- Copyright 2009 Canonical Ltd.  This software is licensed under the
-- GNU Affero General Public License version 3 (see the file LICENSE).

SET client_min_messages=ERROR;

-- The schema patch required for the Soyuz buildd generalisation, see
-- https://dev.launchpad.net/Soyuz/Specs/BuilddGeneralisation for details.
-- Bug #485524.

-- Please note : this change is needed in order to estimate build farm job
-- dispatch times irrespective of the job type.

-- Step 1
-- Add an estimated duration column to the `BuildQueue` table first.
ALTER TABLE ONLY buildqueue
ADD COLUMN estimated_duration interval NOT NULL DEFAULT '0 sec';

-- Step 2
-- Migrate the estimated duration values from the `Build` table.
UPDATE buildqueue
    SET estimated_duration = build.estimated_build_duration
    FROM buildpackagejob, build
    WHERE
        buildqueue.job = buildpackagejob.job
        AND buildpackagejob.build = build.id
        AND build.estimated_build_duration IS NOT NULL;

-- Step 3
-- Drop the obsolete 'estimated_build_duration' column from the `Build` table.
ALTER TABLE ONLY build DROP COLUMN estimated_build_duration;

INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 14, 0);