From 95fc64b4894e5985bb8d0e5e944b2cda38c9a58c Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Thu, 25 Sep 2014 18:36:24 +0530 Subject: Add support for postgresql * revert changes in message_id_has encoding by barry * Change message_id_hash column to LargeBinary (from previously mistaken one i.e.unicode) * add missing import in database/types.py * fix a bug in database/Model.py, transaction has no method abort(), instead it is rollback() --- src/mailman/database/postgresql.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mailman/database/postgresql.py') diff --git a/src/mailman/database/postgresql.py b/src/mailman/database/postgresql.py index 59fff0865..ca1068302 100644 --- a/src/mailman/database/postgresql.py +++ b/src/mailman/database/postgresql.py @@ -40,15 +40,14 @@ class PostgreSQLDatabase(SABaseDatabase): restart from zero for new tests. """ super(PostgreSQLDatabase, self)._post_reset(store) - from mailman.database.model import ModelMeta - classes = sorted(ModelMeta._class_registry, - key=attrgetter('__storm_table__')) + from mailman.database.model import Model + tables = reversed(Model.metadata.sorted_tables) # Recipe adapted from # http://stackoverflow.com/questions/544791/ # django-postgresql-how-to-reset-primary-key - for model_class in classes: + for table in tables: store.execute("""\ SELECT setval('"{0}_id_seq"', coalesce(max("id"), 1), max("id") IS NOT null) FROM "{0}"; - """.format(model_class.__storm_table__)) + """.format(table)) -- cgit v1.2.3-70-g09d2