# 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 <ftpmaster@debian.org>
-@copyright: 2011 Torsten Werner <twerner@debian.org>
+@copyright: 2011 Mark Hymers <mhy@debian.org>
@license: GNU General Public License version 2 or later
"""
################################################################################
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:
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))