diff options
| author | Aurélien Bompard | 2014-10-10 11:43:25 +0200 |
|---|---|---|
| committer | Aurélien Bompard | 2014-10-10 11:43:25 +0200 |
| commit | 18fd22440e4e3e9e0400681be4aad901c8be3cfd (patch) | |
| tree | bd0c48284ea83a107fa6d780aa4137776b644ab9 /src/mailman/database | |
| parent | 135dbdb4dc2d950a078ba9965b75d07b1c2a9e9e (diff) | |
| parent | 9cc31df3831298fcc1d698306a74cad6f82a1dc1 (diff) | |
| download | mailman-18fd22440e4e3e9e0400681be4aad901c8be3cfd.tar.gz mailman-18fd22440e4e3e9e0400681be4aad901c8be3cfd.tar.zst mailman-18fd22440e4e3e9e0400681be4aad901c8be3cfd.zip | |
Merge from Abhilash's branch
Diffstat (limited to 'src/mailman/database')
4 files changed, 36 insertions, 31 deletions
diff --git a/src/mailman/database/alembic/__init__.py b/src/mailman/database/alembic/__init__.py index 73f30832e..a2f7418ba 100644 --- a/src/mailman/database/alembic/__init__.py +++ b/src/mailman/database/alembic/__init__.py @@ -29,4 +29,4 @@ from alembic.config import Config from mailman.utilities.modules import expand_path -alembic_cfg=Config(expand_path("python:mailman.config.alembic")) +alembic_cfg=Config(expand_path("python:mailman.config.schema")) diff --git a/src/mailman/database/alembic/env.py b/src/mailman/database/alembic/env.py index ffab0fed8..d1a1c557c 100644 --- a/src/mailman/database/alembic/env.py +++ b/src/mailman/database/alembic/env.py @@ -34,9 +34,11 @@ from mailman.core import initialize from mailman.config import config from mailman.database.alembic import alembic_cfg from mailman.database.model import Model -from mailman.utilities.modules import expand_path from mailman.utilities.string import expand +if not config.initialized: + initialize.initialize_1(context.config.config_file_name) + def run_migrations_offline(): diff --git a/src/mailman/database/alembic/versions/429e08420177_initial.py b/src/mailman/database/alembic/versions/429e08420177_initial.py deleted file mode 100644 index e8d612676..000000000 --- a/src/mailman/database/alembic/versions/429e08420177_initial.py +++ /dev/null @@ -1,29 +0,0 @@ -"""Initial migration - -This empty migration file makes sure there is always an alembic_version in the -database. As a consequence, if the DB version is reported as None, it means the -database needs to be created from scratch with SQLAlchemy itself. - -It also removes the "version" table left over from Storm (if it exists). - - -Revision ID: 429e08420177 -Revises: None -Create Date: 2014-10-02 10:18:17.333354 - -""" - -# revision identifiers, used by Alembic. -revision = '429e08420177' -down_revision = None - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.drop_table('version') - - -def downgrade(): - pass diff --git a/src/mailman/database/alembic/versions/51b7f92bd06c_initial.py b/src/mailman/database/alembic/versions/51b7f92bd06c_initial.py new file mode 100644 index 000000000..c5b3e01c5 --- /dev/null +++ b/src/mailman/database/alembic/versions/51b7f92bd06c_initial.py @@ -0,0 +1,32 @@ +"""initial + +Revision ID: 51b7f92bd06c +Revises: None +Create Date: 2014-10-10 09:53:35.624472 + +""" + +# revision identifiers, used by Alembic. +revision = '51b7f92bd06c' +down_revision = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_table('version') + op.drop_column('mailinglist', 'acceptable_aliases_id') + op.create_index(op.f('ix_user__user_id'), 'user', ['_user_id'], unique=False) + op.drop_index('ix_user_user_id', table_name='user') + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.create_table('version') + op.create_index('ix_user_user_id', 'user', ['_user_id'], unique=False) + op.drop_index(op.f('ix_user__user_id'), table_name='user') + op.add_column('mailinglist', sa.Column('acceptable_aliases_id', sa.INTEGER(), nullable=True)) + ### end Alembic commands ### |
