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
6
 
"""Added new bounce attributes
 
 
Revision ID: 58858f75303c
 
Revises: 2d2d0ef0828f
 
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, is_sqlite
 
 
# revision identifiers, used by Alembic.
 
revision = '58858f75303c'
 
down_revision = '2d2d0ef0828f'
 
 
 
def upgrade():
 
# ### commands auto generated by Alembic - please adjust! ###
 
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! ###
 
if not is_sqlite(op.get_bind()):
 
op.drop_column('address', 'bounce_info')
 
op.drop_constraint('domain', 'uq_domain_mailhost')
 
# ### end Alembic commands ###
Loading