X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdakdb%2Fupdate43.py;h=430cc3581dc42c98a9666719612e2f004ba95418;hb=039b87c9a0d68c3acd4cd893396334d6f3ea06a0;hp=b9c7f5847e5726a11535452150cbb82443fe2b44;hpb=62a46fad36e7f656052e19dce6b3cf5a1552c1b2;p=dak.git diff --git a/dak/dakdb/update43.py b/dak/dakdb/update43.py old mode 100755 new mode 100644 index b9c7f584..430cc358 --- a/dak/dakdb/update43.py +++ b/dak/dakdb/update43.py @@ -2,11 +2,10 @@ # coding=utf8 """ -Remove old contents tables that are no longer needed by the current -implementation. +Fix up constraints for pg 9.0 @contact: Debian FTP Master -@copyright: 2011 Torsten Werner +@copyright: 2011 Mark Hymers @license: GNU General Public License version 2 or later """ @@ -33,20 +32,20 @@ from socket import gethostname; ################################################################################ def do_update(self): """ - Remove old contents tables that are no longer needed by the current - implementation. + Fix up constraints for pg 9.0 """ print __doc__ try: c = self.db.cursor() - # remove useless type casts - for table in ('pending_bin_contents', 'deb_contents', 'udeb_contents'): - c.execute("DROP TABLE %s" % table) + c.execute("ALTER TABLE policy_queue DROP constraint policy_queue_perms_check") + c.execute("ALTER TABLE policy_queue DROP constraint policy_queue_change_perms_check") + c.execute("ALTER TABLE policy_queue ADD CONSTRAINT policy_queue_perms_check CHECK (perms SIMILAR TO '[0-7][0-7][0-7][0-7]')") + c.execute("ALTER TABLE policy_queue ADD CONSTRAINT policy_queue_change_perms_check CHECK (change_perms SIMILAR TO '[0-7][0-7][0-7][0-7]')") c.execute("UPDATE config SET value = '43' WHERE name = 'db_revision'") self.db.commit() - except psycopg2.ProgrammingError, msg: + except psycopg2.ProgrammingError as msg: self.db.rollback() - raise DBUpdateError, 'Unable to apply sick update 43, rollback issued. Error message : %s' % (str(msg)) + raise DBUpdateError('Unable to apply update 43, rollback issued. Error message : %s' % (str(msg)))