diff options
Diffstat (limited to 'src/mailman/database')
| -rw-r--r-- | src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py b/src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py new file mode 100644 index 000000000..bf42e2232 --- /dev/null +++ b/src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py @@ -0,0 +1,45 @@ +"""add_serverowner_domainowner + +Revision ID: 46e92facee7 +Revises: 33e1f5f6fa8 +Create Date: 2015-03-20 16:01:25.007242 + +""" + +# revision identifiers, used by Alembic. +revision = '46e92facee7' +down_revision = '33e1f5f6fa8' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.create_table('owner', + sa.Column('user_id', sa.Integer(), nullable=False), + sa.Column('domain_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['domain_id'], ['domain.id'], ), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.PrimaryKeyConstraint('user_id', 'domain_id') + ) + op.add_column('user', sa.Column('is_serverowner', sa.Boolean(), + nullable=True)) + if op.get_bind().dialect.name != 'sqlite': + op.drop_column('domain', 'contact_address') + # The migration below may be because the first migration was created + # before we changed this attribute to a primary_key + op.create_foreign_key('_preferred_address', 'user', 'address', + ['_preferred_address_id'], ['id']) + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_column('user', 'is_serverowner') + if op.get_bind().dialect.name != 'sqlite': + op.add_column('domain', sa.Column('contact_address', sa.VARCHAR(), + nullable=True)) + op.drop_constraint('_preferred_address', 'user', type_='foreignkey') + op.drop_table('owner') + ### end Alembic commands ### |
