summaryrefslogtreecommitdiff
path: root/src/mailman/database/alembic/versions
diff options
context:
space:
mode:
authorBarry Warsaw2015-12-20 13:53:25 -0500
committerBarry Warsaw2015-12-20 13:53:25 -0500
commit573e60947a0a688afccf81bd9230fed9c6bbb650 (patch)
tree095789f39822834197ab9554c82e905e5ca1aaf6 /src/mailman/database/alembic/versions
parentbb45766f91ddce5e68ddf0a1fe6fe67d2f93dd60 (diff)
downloadmailman-573e60947a0a688afccf81bd9230fed9c6bbb650.tar.gz
mailman-573e60947a0a688afccf81bd9230fed9c6bbb650.tar.zst
mailman-573e60947a0a688afccf81bd9230fed9c6bbb650.zip
Diffstat (limited to 'src/mailman/database/alembic/versions')
-rw-r--r--src/mailman/database/alembic/versions/70af5a4e5790_digests.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mailman/database/alembic/versions/70af5a4e5790_digests.py b/src/mailman/database/alembic/versions/70af5a4e5790_digests.py
index 2b53202d9..9a03678fe 100644
--- a/src/mailman/database/alembic/versions/70af5a4e5790_digests.py
+++ b/src/mailman/database/alembic/versions/70af5a4e5790_digests.py
@@ -10,14 +10,25 @@ Create Date: 2015-12-19 12:05:42.202998
revision = '70af5a4e5790'
down_revision = '47294d3a604'
-from alembic import op
+import os
import sqlalchemy as sa
+from alembic import op
+from mailman.config import config
+
def upgrade():
with op.batch_alter_table('mailinglist') as batch_op:
batch_op.alter_column('digestable', new_column_name='digests_enabled')
batch_op.drop_column('nondigestable')
+ # Non-database migration: rename the list's data-path.
+ for dirname in os.listdir(config.LIST_DATA_DIR):
+ if '@' in dirname:
+ old_name = os.path.join(config.LIST_DATA_DIR, dirname)
+ listname, at, domain = dirname.partition('@')
+ new_name = os.path.join(config.LIST_DATA_DIR,
+ '{}.{}'.format(listname, domain))
+ os.rename(old_name, new_name)
def downgrade():
@@ -25,5 +36,10 @@ def downgrade():
batch_op.alter_column('digests_enabled', new_column_name='digestable')
# The data for this column is lost, it's not used anyway.
batch_op.add_column(sa.Column('nondigestable', sa.Boolean))
-
-# XXX - move list.data_path
+ for dirname in os.listdir(config.LIST_DATA_DIR):
+ if '@' not in dirname:
+ old_name = os.path.join(config.LIST_DATA_DIR, dirname)
+ listname, domain = dirname.split('.', 1)
+ new_name = os.path.join(config.LIST_DATA_DIR,
+ '{}@{}'.format(listname, domain))
+ os.rename(old_name, new_name)