X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdakdb%2Fupdate22.py;h=b6fbbb447b37ac776085ca91efeb1449f63fd21f;hb=9f523eb071132709bcb68234f9a8bd7c22d3565c;hp=7234555eda7ea8be18dd6785eccedfdd3929dbc5;hpb=d3a3c234a460e8c4f63fc7eaab651585e986d7c0;p=dak.git diff --git a/dak/dakdb/update22.py b/dak/dakdb/update22.py index 7234555e..b6fbbb44 100755 --- a/dak/dakdb/update22.py +++ b/dak/dakdb/update22.py @@ -56,9 +56,12 @@ def do_update(self): print "Adding policy_queue table" c.execute("""CREATE TABLE policy_queue ( - id SERIAL PRIMARY KEY, - queue_name TEXT NOT NULL UNIQUE, - path TEXT NOT NULL)""") + id SERIAL PRIMARY KEY, + queue_name TEXT NOT NULL UNIQUE, + path TEXT NOT NULL, + perms CHAR(4) NOT NULL DEFAULT '0660' CHECK (perms SIMILAR TO '^[0-7][0-7][0-7][0-7]$'), + change_perms CHAR(4) NOT NULL DEFAULT '0660' CHECK (change_perms SIMILAR TO '^[0-7][0-7][0-7][0-7]$') + )""") print "Copying queues" queues = {} @@ -95,7 +98,7 @@ def do_update(self): ON DELETE CASCADE""") - c.execute("""ALTER TABLE suite DROP CONSTRAINT suite_policy_queue_fkey""") + c.execute("""ALTER TABLE suite DROP CONSTRAINT suite_policy_queue_id_fkey""") c.execute("""UPDATE suite SET policy_queue_id = (SELECT policy_queue.id FROM policy_queue @@ -204,6 +207,9 @@ def do_update(self): print "Getting rid of old queue table" c.execute("""DROP TABLE queue""") + print "Sorting out permission columns" + c.execute("""UPDATE policy_queue SET perms = '0664' WHERE queue_name IN ('proposedupdates', 'oldproposedupdates')""") + print "Moving known_changes table" c.execute("""ALTER TABLE known_changes RENAME TO changes""")