X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdakdb%2Fupdate26.py;h=358f2ae46907ed5be49516dfe458e85aee523480;hb=d31ae14a9de247d47d9ff7b3f36705a58a065916;hp=3c7b0825f3bb77b8d7e789220966a8133a62e590;hpb=aa05503ac04f3e6cb22c22ab9b75d72abe4a4ca1;p=dak.git diff --git a/dak/dakdb/update26.py b/dak/dakdb/update26.py old mode 100755 new mode 100644 index 3c7b0825..358f2ae4 --- a/dak/dakdb/update26.py +++ b/dak/dakdb/update26.py @@ -29,18 +29,18 @@ def do_update(self): updatetables = ['architecture', 'archive', 'bin_associations', 'bin_contents', 'binaries', 'binary_acl', 'binary_acl_map', 'build_queue', 'build_queue_files', - 'changes', 'changes_pending_binaries', 'changes_pending_files', - 'changes_pending_files_map', 'changes_pending_source', 'changes_pending_source_files', - 'changes_pool_files', 'component', 'config', 'dsc_files', 'files', 'fingerprint', - 'keyring_acl_map', 'keyrings', 'location', 'maintainer', 'new_comments', 'override', - 'override_type', 'policy_queue', 'priority', 'section', 'source', 'source_acl', - 'src_associations', 'src_format', 'src_uploaders', 'suite', 'suite_architectures', + 'changes', 'changes_pending_binaries', 'changes_pending_files', + 'changes_pending_files_map', 'changes_pending_source', 'changes_pending_source_files', + 'changes_pool_files', 'component', 'config', 'dsc_files', 'files', 'fingerprint', + 'keyring_acl_map', 'keyrings', 'location', 'maintainer', 'new_comments', 'override', + 'override_type', 'policy_queue', 'priority', 'section', 'source', 'source_acl', + 'src_associations', 'src_format', 'src_uploaders', 'suite', 'suite_architectures', 'suite_build_queue_copy', 'suite_src_formats', 'uid', 'upload_blocks'] c = self.db.cursor() print "Create trigger function." - c.execute("""CREATE OR REPLACE FUNCTION tfunc_set_modified() RETURNS trigger AS $$ + c.execute("""CREATE OR REPLACE FUNCTION tfunc_set_modified() RETURNS trigger AS $$ BEGIN NEW.modified = now(); return NEW; END; $$ LANGUAGE 'plpgsql'""") @@ -54,14 +54,14 @@ def do_update(self): c.execute("ALTER TABLE %s ADD COLUMN modified TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()" % updatetable) print "Create modified trigger." - c.execute("""CREATE TRIGGER modified_%s BEFORE UPDATE ON %s + c.execute("""CREATE TRIGGER modified_%s BEFORE UPDATE ON %s FOR EACH ROW EXECUTE PROCEDURE tfunc_set_modified()""" % (updatetable, updatetable)) - + print "Committing" c.execute("UPDATE config SET value = '26' WHERE name = 'db_revision'") self.db.commit() - except psycopg2.InternalError, msg: + except psycopg2.InternalError as msg: self.db.rollback() - raise DBUpdateError, "Database error, rollback issued. Error message : %s" % (str(msg)) + raise DBUpdateError("Database error, rollback issued. Error message : %s" % (str(msg)))