app-MAIL-temp/migrations/versions/2021_051419_04b16f5e207e_.py
2021-05-14 19:50:32 +02:00

48 lines
1.6 KiB
Python

"""empty message
Revision ID: 04b16f5e207e
Revises: 5c77d685df87
Create Date: 2021-05-14 19:44:48.094516
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '04b16f5e207e'
down_revision = '5c77d685df87'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('hibp',
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('id', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('alias_hibp',
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('alias_id', sa.Integer(), nullable=True),
sa.Column('hibp_id', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['alias_id'], ['alias.id'], ),
sa.ForeignKeyConstraint(['hibp_id'], ['hibp.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('alias_id', 'hibp_id', name='uq_alias_hibp')
)
op.add_column('alias', sa.Column('hibp_last_check', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('alias', 'hibp_last_check')
op.drop_table('alias_hibp')
op.drop_table('hibp')
# ### end Alembic commands ###