summaryrefslogtreecommitdiff
path: root/src/mailman/database/postgresql.py
diff options
context:
space:
mode:
authorAbhilash Raj2014-09-25 18:36:24 +0530
committerAbhilash Raj2014-09-25 18:36:24 +0530
commit95fc64b4894e5985bb8d0e5e944b2cda38c9a58c (patch)
tree697f18eb33eddc8a16e2b09f4b4be4aaf0cf0dbe /src/mailman/database/postgresql.py
parentf2c619de76bd1614a6609f1a61e34ecf8a4344fc (diff)
downloadmailman-95fc64b4894e5985bb8d0e5e944b2cda38c9a58c.tar.gz
mailman-95fc64b4894e5985bb8d0e5e944b2cda38c9a58c.tar.zst
mailman-95fc64b4894e5985bb8d0e5e944b2cda38c9a58c.zip
Diffstat (limited to 'src/mailman/database/postgresql.py')
-rw-r--r--src/mailman/database/postgresql.py9
1 files changed, 4 insertions, 5 deletions
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))