app-MAIL-temp/migrations/versions/2020_031416_11a35b448f83_.py

46 lines
1.7 KiB
Python
Raw Normal View History

2020-03-14 16:36:18 +01:00
"""empty message
Revision ID: 11a35b448f83
Revises: 628a5438295c
Create Date: 2020-03-14 16:35:13.564982
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '11a35b448f83'
down_revision = '628a5438295c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('refused_email',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('full_report_path', sa.String(length=128), nullable=False),
sa.Column('path', sa.String(length=128), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('delete_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('full_report_path'),
sa.UniqueConstraint('path')
)
op.add_column('forward_email_log', sa.Column('refused_email_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'forward_email_log', 'refused_email', ['refused_email_id'], ['id'], ondelete='SET NULL')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'forward_email_log', type_='foreignkey')
op.drop_column('forward_email_log', 'refused_email_id')
op.drop_table('refused_email')
# ### end Alembic commands ###