app-MAIL-temp/migrations/versions/2021_092018_cf1e8c1bc737_.py
2021-09-20 18:23:19 +02:00

52 lines
2.0 KiB
Python

"""empty message
Revision ID: cf1e8c1bc737
Revises: d8c55e79da54
Create Date: 2021-09-20 18:14:17.798925
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cf1e8c1bc737'
down_revision = 'd8c55e79da54'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('auto_create_rule',
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('custom_domain_id', sa.Integer(), nullable=False),
sa.Column('regex', sa.String(length=512), nullable=False),
sa.Column('order', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['custom_domain_id'], ['custom_domain.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('custom_domain_id', 'order', name='uq_auto_create_rule_order')
)
op.create_table('auto_create_rule__mailbox',
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('auto_create_rule_id', sa.Integer(), nullable=False),
sa.Column('mailbox_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['auto_create_rule_id'], ['auto_create_rule.id'], ondelete='cascade'),
sa.ForeignKeyConstraint(['mailbox_id'], ['mailbox.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('auto_create_rule_id', 'mailbox_id', name='uq_auto_create_rule_mailbox')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('auto_create_rule__mailbox')
op.drop_table('auto_create_rule')
# ### end Alembic commands ###