Skip to content
Snippets Groups Projects

[WIP] Modify schema, creation of new attributes

Closed Aaryan Bhagat requested to merge berserker1/mailman:modify_schema into master
1 unresolved thread
Files
3
@@ -10,7 +10,7 @@ Create Date: 2019-06-28 01:10:48.210528
import sqlalchemy as sa
from alembic import op
from mailman.database.helpers import exists_in_db
from mailman.database.helpers import exists_in_db, is_sqlite
# revision identifiers, used by Alembic.
revision = '58858f75303c'
@@ -22,15 +22,11 @@ def upgrade():
if not exists_in_db(op.get_bind(), 'address', 'bounce_info'):
op.add_column('address', sa.Column('bounce_info', sa.PickleType(),
nullable=True))
with op.batch_alter_table('domain') as batch_op:
batch_op.create_unique_constraint('uq_domain_mailhost', ['mail_host'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('domain') as batch_op:
batch_op.drop_constraint('uq_domain_mailhost', type_='unique')
with op.batch_alter_table('address') as batch_op:
batch_op.drop_column('bounce_info')
if not is_sqlite(op.get_bind()):
op.drop_column('address', 'bounce_info')
# ### end Alembic commands ###
Loading