"""evatest

Revision ID: b92add5e2ed7
Revises: 8313ee70067b
Create Date: 2025-02-06 14:16:40.047115

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b92add5e2ed7'
down_revision = '8313ee70067b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_testcycle_cmf_test_configuration',
    sa.Column('id', sa.String(length=128), nullable=False),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.ForeignKeyConstraint(['left_id'], ['cmf_testcycle.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_test_configuration.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_testcycle_cmf_test_configuration_left_id'), 'cmf_testcycle_cmf_test_configuration', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_testcycle_cmf_test_configuration_parent_id'), 'cmf_testcycle_cmf_test_configuration', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_testcycle_cmf_test_configuration_right_id'), 'cmf_testcycle_cmf_test_configuration', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_testcycle_cmf_test_configuration_root_id'), 'cmf_testcycle_cmf_test_configuration', ['root_id'], unique=False)
    op.drop_index('ix_cmf_testcycle_test_configuration_id', table_name='cmf_testcycle')
    op.drop_constraint('cmf_testcycle_test_configuration_id_fkey', 'cmf_testcycle', type_='foreignkey')
    op.drop_column('cmf_testcycle', 'test_configuration_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cmf_testcycle', sa.Column('test_configuration_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
    op.create_foreign_key('cmf_testcycle_test_configuration_id_fkey', 'cmf_testcycle', 'cmf_test_configuration', ['test_configuration_id'], ['id'])
    op.create_index('ix_cmf_testcycle_test_configuration_id', 'cmf_testcycle', ['test_configuration_id'], unique=False)
    op.drop_index(op.f('ix_cmf_testcycle_cmf_test_configuration_root_id'), table_name='cmf_testcycle_cmf_test_configuration')
    op.drop_index(op.f('ix_cmf_testcycle_cmf_test_configuration_right_id'), table_name='cmf_testcycle_cmf_test_configuration')
    op.drop_index(op.f('ix_cmf_testcycle_cmf_test_configuration_parent_id'), table_name='cmf_testcycle_cmf_test_configuration')
    op.drop_index(op.f('ix_cmf_testcycle_cmf_test_configuration_left_id'), table_name='cmf_testcycle_cmf_test_configuration')
    op.drop_table('cmf_testcycle_cmf_test_configuration')
    # ### end Alembic commands ###
