"""Initial Migration

Revision ID: 147710f54a5b
Revises: 
Create Date: 2021-05-20 20:52:07.997608

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '147710f54a5b'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('state',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('external_id', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_state_id'), 'state', ['id'], unique=False)
    op.create_table('district',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('state_id', sa.Integer(), nullable=True),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('external_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['state_id'], ['state.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_district_id'), 'district', ['id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_district_id'), table_name='district')
    op.drop_table('district')
    op.drop_index(op.f('ix_state_id'), table_name='state')
    op.drop_table('state')
    # ### end Alembic commands ###
