"""add eotk provider

Revision ID: 7ecfb305d243
Revises: 7155ba7dec60
Create Date: 2022-05-13 15:34:59.922410

"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '7ecfb305d243'
down_revision = '7155ba7dec60'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('eotk_instance',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('added', sa.DateTime(), nullable=False),
                    sa.Column('updated', sa.DateTime(), nullable=False),
                    sa.Column('deprecated', sa.DateTime(), nullable=True),
                    sa.Column('deprecation_reason', sa.String(), nullable=True),
                    sa.Column('destroyed', sa.DateTime(), nullable=True),
                    sa.Column('group_id', sa.Integer(), nullable=False),
                    sa.Column('provider', sa.String(length=20), nullable=False),
                    sa.Column('region', sa.String(length=20), nullable=False),
                    sa.Column('instance_id', sa.String(length=255), nullable=True),
                    sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_eotk_instance_group_id_group')),
                    sa.PrimaryKeyConstraint('id', name=op.f('pk_eotk_instance'))
                    )
    with op.batch_alter_table('eotk', schema=None) as batch_op:
        batch_op.add_column(sa.Column('provider', sa.String(length=20), nullable=False))

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('eotk', schema=None) as batch_op:
        batch_op.drop_column('provider')

    op.drop_table('eotk_instance')
    # ### end Alembic commands ###
