4 Add some meta info to queues
6 @contact: Debian FTP Master <ftpmaster@debian.org>
7 @copyright: 2009 Mark Hymers <mhy@debian.org>
8 @license: GNU General Public License version 2 or later
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 print "Add meta info columns to queues."
33 c.execute("ALTER TABLE policy_queue ADD COLUMN generate_metadata BOOL DEFAULT FALSE NOT NULL")
34 c.execute("ALTER TABLE policy_queue ADD COLUMN origin TEXT DEFAULT NULL")
35 c.execute("ALTER TABLE policy_queue ADD COLUMN label TEXT DEFAULT NULL")
36 c.execute("ALTER TABLE policy_queue ADD COLUMN releasedescription TEXT DEFAULT NULL")
37 c.execute("ALTER TABLE policy_queue ADD COLUMN signingkey TEXT DEFAULT NULL")
38 c.execute("ALTER TABLE policy_queue ADD COLUMN stay_of_execution INT4 NOT NULL DEFAULT 86400 CHECK (stay_of_execution >= 0)")
39 c.execute("""ALTER TABLE policy_queue
40 ADD CONSTRAINT policy_queue_meta_sanity_check
41 CHECK ( (generate_metadata IS FALSE)
42 OR (origin IS NOT NULL AND label IS NOT NULL AND releasedescription IS NOT NULL) )""")
44 c.execute("ALTER TABLE build_queue ADD COLUMN generate_metadata BOOL DEFAULT FALSE NOT NULL")
45 c.execute("ALTER TABLE build_queue ADD COLUMN origin TEXT DEFAULT NULL")
46 c.execute("ALTER TABLE build_queue ADD COLUMN label TEXT DEFAULT NULL")
47 c.execute("ALTER TABLE build_queue ADD COLUMN releasedescription TEXT DEFAULT NULL")
48 c.execute("ALTER TABLE build_queue ADD COLUMN signingkey TEXT DEFAULT NULL")
49 c.execute("ALTER TABLE build_queue ADD COLUMN stay_of_execution INT4 NOT NULL DEFAULT 86400 CHECK (stay_of_execution >= 0)")
50 c.execute("""ALTER TABLE build_queue
51 ADD CONSTRAINT build_queue_meta_sanity_check
52 CHECK ( (generate_metadata IS FALSE)
53 OR (origin IS NOT NULL AND label IS NOT NULL AND releasedescription IS NOT NULL) )""")
56 c.execute("UPDATE config SET value = '24' WHERE name = 'db_revision'")
59 except psycopg2.InternalError as msg:
61 raise DBUpdateError("Database error, rollback issued. Error message : %s" % (str(msg)))