app/migrations/versions/2020_080112_a2b95b04d1f7_.py

40 lines
1.2 KiB
Python
Raw Normal View History

2020-08-01 18:48:03 +08:00
"""empty message
Revision ID: a2b95b04d1f7
Revises: b77ab8c47cc7
Create Date: 2020-08-01 12:43:56.049075
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a2b95b04d1f7'
down_revision = 'b77ab8c47cc7'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('domain_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('domain_id', sa.Integer(), nullable=False),
sa.Column('mailbox_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['domain_id'], ['custom_domain.id'], ondelete='cascade'),
sa.ForeignKeyConstraint(['mailbox_id'], ['mailbox.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('domain_id', 'mailbox_id', name='uq_domain_mailbox')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('domain_mailbox')
# ### end Alembic commands ###