"""add projects to git_plugin

Revision ID: 2b0779e2d7fe
Revises: c26ab9aa6e9d
Create Date: 2023-07-18 12:20:56.036286

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '2b0779e2d7fe'
down_revision = 'c26ab9aa6e9d'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_project_cmf_plugin_git',
    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_project.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_plugin_git.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_project_cmf_plugin_git_left_id'), 'cmf_project_cmf_plugin_git', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_project_cmf_plugin_git_parent_id'), 'cmf_project_cmf_plugin_git', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_project_cmf_plugin_git_right_id'), 'cmf_project_cmf_plugin_git', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_project_cmf_plugin_git_root_id'), 'cmf_project_cmf_plugin_git', ['root_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cmf_project_cmf_plugin_git_root_id'), table_name='cmf_project_cmf_plugin_git')
    op.drop_index(op.f('ix_cmf_project_cmf_plugin_git_right_id'), table_name='cmf_project_cmf_plugin_git')
    op.drop_index(op.f('ix_cmf_project_cmf_plugin_git_parent_id'), table_name='cmf_project_cmf_plugin_git')
    op.drop_index(op.f('ix_cmf_project_cmf_plugin_git_left_id'), table_name='cmf_project_cmf_plugin_git')
    op.drop_table('cmf_project_cmf_plugin_git')
    # ### end Alembic commands ###
