~barry/mailman/events-and-web

« back to all changes in this revision

Viewing changes to src/mailman/database/schema/mm_20120407000000.py

  • Committer: Barry Warsaw
  • Date: 2012-08-20 15:06:03 UTC
  • Revision ID: barry@list.org-20120820150603-31d0tove8m7swhfp
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.   

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 - archive, archive_private -> archive_policy
28
28
 
29
29
* Remove:
 
30
 - archive_volume_frequency
30
31
 - generic_nonmember_action
31
32
 - nntp_host
32
33
 
116
117
    store.execute(
117
118
        'ALTER TABLE mailinglist '
118
119
        '   RENAME COLUMN include_list_post_header TO allow_list_posts;')
119
 
    # Do the column drop next.
120
 
    store.execute('ALTER TABLE mailinglist DROP COLUMN nntp_host;')
 
120
    # Do the easy column drops next.
 
121
    for column in ('archive_volume_frequency', 
 
122
                   'generic_nonmember_action',
 
123
                   'nntp_host'):
 
124
        store.execute(
 
125
            'ALTER TABLE mailinglist DROP COLUMN {0};'.format(column))
121
126
    # Now do the trickier collapsing of values.  Add the new columns.
122
127
    store.execute('ALTER TABLE mailinglist ADD COLUMN archive_policy INTEGER;')
123
128
    # Query the database for the old values of archive and archive_private in
131
136
                          archive_policy(archive, archive_private),
132
137
                          id))
133
138
    # Now drop the old columns.
134
 
    for column in ('archive', 'archive_private', 'generic_nonmember_action'):
 
139
    for column in ('archive', 'archive_private'):
135
140
        store.execute(
136
141
            'ALTER TABLE mailinglist DROP COLUMN {0};'.format(column))
137
142
    # Record the migration in the version table.