app-MAIL-temp/migrations/versions/2021_051721_6cc7f073b358_.py

52 lines
1.8 KiB
Python
Raw Normal View History

2021-05-13 22:44:16 +02:00
"""empty message
2021-05-17 21:29:29 +02:00
Revision ID: 6cc7f073b358
2021-05-13 22:44:16 +02:00
Revises: 5c77d685df87
2021-05-17 21:29:29 +02:00
Create Date: 2021-05-17 21:26:15.007317
2021-05-13 22:44:16 +02:00
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
2021-05-17 21:29:29 +02:00
revision = '6cc7f073b358'
2021-05-13 22:44:16 +02:00
down_revision = '5c77d685df87'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('hibp',
2021-05-17 21:29:29 +02:00
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
2021-05-13 22:44:16 +02:00
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
2021-05-17 21:29:29 +02:00
sa.Column('name', sa.String(), nullable=False),
2021-05-13 22:44:16 +02:00
sa.PrimaryKeyConstraint('id')
)
2021-05-17 21:29:29 +02:00
op.create_index(op.f('ix_hibp_name'), 'hibp', ['name'], unique=True)
2021-05-13 22:44:16 +02:00
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),
2021-05-17 21:29:29 +02:00
sa.Column('hibp_id', sa.Integer(), nullable=True),
2021-05-13 22:44:16 +02:00
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')
2021-05-17 21:29:29 +02:00
op.drop_index(op.f('ix_hibp_name'), table_name='hibp')
2021-05-13 22:44:16 +02:00
op.drop_table('hibp')
# ### end Alembic commands ###