diff options
| author | Barry Warsaw | 2012-08-20 11:06:03 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-08-20 11:06:03 -0400 |
| commit | 5ad4218c2fb6cdaf735b09e71369fd01be12a332 (patch) | |
| tree | 6e31f4a496d1cfce2267d668ca0d280d50b2857a /src | |
| parent | 33092bbbab94df6170104e6c4f888c424d589cbf (diff) | |
| download | mailman-5ad4218c2fb6cdaf735b09e71369fd01be12a332.tar.gz mailman-5ad4218c2fb6cdaf735b09e71369fd01be12a332.tar.zst mailman-5ad4218c2fb6cdaf735b09e71369fd01be12a332.zip | |
A few fixes for schema migration on PostgreSQL.
- migration.rst needs special cleanup since the Version table is no longer
wiped by the test machinery. This only caused failures when running
the migration.rst test multiple times, and only on PostgreSQL.
- Complete the removal of archive_volume_frequency and
generic_nonmember_action for PostgreSQL.
- Remove setting archive_volume_frequency in the default style.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/database/docs/migration.rst | 14 | ||||
| -rw-r--r-- | src/mailman/database/schema/mm_20120407000000.py | 11 | ||||
| -rw-r--r-- | src/mailman/styles/default.py | 1 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/mailman/database/docs/migration.rst b/src/mailman/database/docs/migration.rst index a4d25d648..6216f9bbc 100644 --- a/src/mailman/database/docs/migration.rst +++ b/src/mailman/database/docs/migration.rst @@ -180,3 +180,17 @@ You'll notice that the ...04 version is not present. 20129999000001 20129999000002 20129999000003 + + +.. cleanup: + Because the Version table holds schema migration data, it will not be + cleaned up by the standard test suite. This is generally not a problem + for SQLite since each test gets a new database file, but for PostgreSQL, + this will cause migration.rst to fail on subsequent runs. So let's just + clean up the database explicitly. + + >>> results = config.db.store.execute(""" + ... DELETE FROM version WHERE version.version >= '201299990000' + ... OR version.component = 'test'; + ... """) + >>> config.db.commit() diff --git a/src/mailman/database/schema/mm_20120407000000.py b/src/mailman/database/schema/mm_20120407000000.py index 89bc52eca..068a05834 100644 --- a/src/mailman/database/schema/mm_20120407000000.py +++ b/src/mailman/database/schema/mm_20120407000000.py @@ -27,6 +27,7 @@ All column changes are in the `mailinglist` table. - archive, archive_private -> archive_policy * Remove: + - archive_volume_frequency - generic_nonmember_action - nntp_host @@ -116,8 +117,12 @@ def upgrade_postgres(database, store, version, module_path): store.execute( 'ALTER TABLE mailinglist ' ' RENAME COLUMN include_list_post_header TO allow_list_posts;') - # Do the column drop next. - store.execute('ALTER TABLE mailinglist DROP COLUMN nntp_host;') + # Do the easy column drops next. + for column in ('archive_volume_frequency', + 'generic_nonmember_action', + 'nntp_host'): + store.execute( + 'ALTER TABLE mailinglist DROP COLUMN {0};'.format(column)) # Now do the trickier collapsing of values. Add the new columns. store.execute('ALTER TABLE mailinglist ADD COLUMN archive_policy INTEGER;') # Query the database for the old values of archive and archive_private in @@ -131,7 +136,7 @@ def upgrade_postgres(database, store, version, module_path): archive_policy(archive, archive_private), id)) # Now drop the old columns. - for column in ('archive', 'archive_private', 'generic_nonmember_action'): + for column in ('archive', 'archive_private'): store.execute( 'ALTER TABLE mailinglist DROP COLUMN {0};'.format(column)) # Record the migration in the version table. diff --git a/src/mailman/styles/default.py b/src/mailman/styles/default.py index 7e7a6b354..86863726c 100644 --- a/src/mailman/styles/default.py +++ b/src/mailman/styles/default.py @@ -118,7 +118,6 @@ from: .*@uplinkpro.com mlist.default_nonmember_action = Action.hold # Archiver mlist.archive_policy = ArchivePolicy.public - mlist.archive_volume_frequency = 1 mlist.emergency = False mlist.member_moderation_notice = '' mlist.accept_these_nonmembers = [] |
