diff options
| author | Barry Warsaw | 2012-12-28 16:35:08 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2012-12-28 16:35:08 -0500 |
| commit | 582d6e486f9693a2ce082071b747eec468df19b6 (patch) | |
| tree | c25dcc945f161c6d44154c20de72793702be313e /src/mailman/database | |
| parent | 2b663ac20e7898167cf242d3628f8cf0feeab12f (diff) | |
| download | mailman-582d6e486f9693a2ce082071b747eec468df19b6.tar.gz mailman-582d6e486f9693a2ce082071b747eec468df19b6.tar.zst mailman-582d6e486f9693a2ce082071b747eec468df19b6.zip | |
LP: #975692 phase 1
* Rework list style management. No more style priorities or matching.. Now,
you name a style explicitly to apply and that's it.
* create_list() now takes a `style` argument.
* config file now names both a default style to use, and a set of paths to
scan for IStyle instances. (This could be a model for other plugins.)
* added IMailingList.style_name to record the last style applied, but this is
going to be removed in subsequent revisions.
Also:
* Move find_components() and scan_module() from app/finder.py to
utilities/modules.py
* Cleaned up lifecycle.rst for better documentation. Some tests moved to
test_lifecycle.py.
* Remove some unnecessary test tearDown() code.
Diffstat (limited to 'src/mailman/database')
| -rw-r--r-- | src/mailman/database/schema/mm_20121015000000.py | 4 | ||||
| -rw-r--r-- | src/mailman/database/schema/sqlite_20121015000000_01.sql | 1 | ||||
| -rw-r--r-- | src/mailman/database/tests/test_migrations.py | 23 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/mailman/database/schema/mm_20121015000000.py b/src/mailman/database/schema/mm_20121015000000.py index 51e0602e7..bfbf5cb62 100644 --- a/src/mailman/database/schema/mm_20121015000000.py +++ b/src/mailman/database/schema/mm_20121015000000.py @@ -18,6 +18,9 @@ """3.0b2 -> 3.0b3 schema migrations. * bans.mailing_list -> bans.list_id + +Added: +* mailinglist.style """ from __future__ import absolute_import, print_function, unicode_literals @@ -84,5 +87,6 @@ def upgrade_postgres(database, store, version, module_path): WHERE id = {1}; """.format(_make_listid(mailing_list), id)) store.execute('ALTER TABLE ban DROP COLUMN mailing_list;') + store.execute('ALTER TABLE mailinglist ADD COLUMN style_name;') # Record the migration in the version table. database.load_schema(store, version, None, module_path) diff --git a/src/mailman/database/schema/sqlite_20121015000000_01.sql b/src/mailman/database/schema/sqlite_20121015000000_01.sql index c0df75111..e9e3661e0 100644 --- a/src/mailman/database/schema/sqlite_20121015000000_01.sql +++ b/src/mailman/database/schema/sqlite_20121015000000_01.sql @@ -20,3 +20,4 @@ INSERT INTO ban_backup SELECT FROM ban; ALTER TABLE ban_backup ADD COLUMN list_id TEXT; +ALTER TABLE mailinglist ADD COLUMN style_name TEXT; diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py index 4401b030f..e813d4341 100644 --- a/src/mailman/database/tests/test_migrations.py +++ b/src/mailman/database/tests/test_migrations.py @@ -24,6 +24,8 @@ __all__ = [ 'TestMigration20120407MigratedData', 'TestMigration20120407Schema', 'TestMigration20120407UnchangedData', + 'TestMigration20121015MigratedData', + 'TestMigration20121015Schema', ] @@ -151,8 +153,10 @@ class TestMigration20120407UnchangedData(MigrationTestBase): 'mailman.database.tests.data', 'migration_{0}_1.sql'.format(self._database.TAG)) self._database.load_sql(self._database.store, sample_data) - # Update to the current migration we're testing. - self._database.load_migrations('20120407000000') + # XXX 2012-12-28: We have to load the last migration defined in the + # system, otherwise the ORM model will not match the SQL table + # definitions and we'll get OperationalErrors from SQLite. + self._database.load_migrations('20121015000000') def test_migration_domains(self): # Test that the domains table, which isn't touched, doesn't change. @@ -216,8 +220,10 @@ class TestMigration20120407MigratedData(MigrationTestBase): self._database.load_sql(self._database.store, sample_data) def _upgrade(self): - # Update to the current migration we're testing. - self._database.load_migrations('20120407000000') + # XXX 2012-12-28: We have to load the last migration defined in the + # system, otherwise the ORM model will not match the SQL table + # definitions and we'll get OperationalErrors from SQLite. + self._database.load_migrations('20121015000000') def test_migration_archive_policy_never_0(self): # Test that the new archive_policy value is updated correctly. In the @@ -369,6 +375,10 @@ class TestMigration20121015Schema(MigrationTestBase): ['20121014999999'], ('list_id',), ('mailing_list',)) + self._missing_present('mailinglist', + ['20121014999999'], + ('style_name',), + ()) def test_post_upgrade_column_migrations(self): self._missing_present('ban', @@ -376,6 +386,11 @@ class TestMigration20121015Schema(MigrationTestBase): '20121015000000'], ('mailing_list',), ('list_id',)) + self._missing_present('mailinglist', + ['20121014999999', + '20121015000000'], + (), + ('style_name',)) class TestMigration20121015MigratedData(MigrationTestBase): |
