~launchpad-pqm/launchpad/devel

10129.6.1 by Jelmer Vernooij
Store all code import URLs in branch_url database field.
1
SET client_min_messages=ERROR;
2
10129.6.3 by Tim Penhey
Starting to unify the urls for code imports, particularly in the browser code.
3
ALTER TABLE CodeImport ADD COLUMN url text;
4
UPDATE CodeImport SET url = git_repo_url WHERE rcs_type = 4;
5
UPDATE CodeImport SET url = svn_branch_url WHERE rcs_type IN (2, 3);
10129.6.1 by Jelmer Vernooij
Store all code import URLs in branch_url database field.
6
DROP INDEX codeimport__svn_branch_url__idx;
7
DROP INDEX codeimport__git_repo_url__idx;
8
ALTER TABLE CodeImport DROP CONSTRAINT valid_vcs_details;
9
ALTER TABLE CodeImport ADD CONSTRAINT "valid_vcs_details" CHECK (
10
CASE
11
    WHEN rcs_type = 1
12
         THEN cvs_root IS NOT NULL AND cvs_root <> ''::text AND cvs_module IS NOT NULL AND cvs_module <> ''::text
10129.6.3 by Tim Penhey
Starting to unify the urls for code imports, particularly in the browser code.
13
              AND url IS NULL
10129.6.7 by Tim Penhey
Add hg to the enum to avoid yet another change to the check constraint.
14
    WHEN rcs_type IN (2, 3)
10129.6.1 by Jelmer Vernooij
Store all code import URLs in branch_url database field.
15
         THEN cvs_root IS NULL AND cvs_module IS NULL
10129.6.3 by Tim Penhey
Starting to unify the urls for code imports, particularly in the browser code.
16
              AND url IS NOT NULL AND valid_absolute_url(url)
10129.6.7 by Tim Penhey
Add hg to the enum to avoid yet another change to the check constraint.
17
    WHEN rcs_type IN (4, 5)
18
         -- Git and mercurial imports are not checked for valid urls right now,
19
         -- this is a bug - 506146
20
         THEN cvs_root IS NULL AND cvs_module IS NULL AND url IS NOT NULL
10129.6.1 by Jelmer Vernooij
Store all code import URLs in branch_url database field.
21
    ELSE false
22
END);
23
ALTER TABLE CodeImport DROP COLUMN git_repo_url;
24
ALTER TABLE CodeImport DROP COLUMN svn_branch_url;
25
10129.6.3 by Tim Penhey
Starting to unify the urls for code imports, particularly in the browser code.
26
CREATE UNIQUE INDEX codeimport__url__idx ON CodeImport USING btree (url) WHERE (url is NOT NULL);
10129.6.1 by Jelmer Vernooij
Store all code import URLs in branch_url database field.
27
10129.7.2 by Tim Penhey
Rename db patch to use official patch name.
28
INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 26, 0);