"""empty message

Revision ID: bc0ed8cb5629
Revises: 6cf95957d1f6
Create Date: 2022-08-17 20:56:13.629331

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'bc0ed8cb5629'
down_revision = '6cf95957d1f6'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_sign',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('object_cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('sign', sa.String(), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('signed_object_id', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )

    op.create_table('cmf_document_history_cmf_sign',
    sa.Column('id', sa.String(length=64), 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_document_history.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_sign.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_document_history_cmf_sign_left_id'), 'cmf_document_history_cmf_sign', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_document_history_cmf_sign_parent_id'), 'cmf_document_history_cmf_sign', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_document_history_cmf_sign_right_id'), 'cmf_document_history_cmf_sign', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_document_history_cmf_sign_root_id'), 'cmf_document_history_cmf_sign', ['root_id'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_author_id'), 'cmf_sign', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_created_at'), 'cmf_sign', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_deleted'), 'cmf_sign', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_locked_at'), 'cmf_sign', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_locked_by_id'), 'cmf_sign', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_modified_at'), 'cmf_sign', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_modified_by_id'), 'cmf_sign', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_owner_assistant_id'), 'cmf_sign', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_owner_id'), 'cmf_sign', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_version'), 'cmf_sign', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_sign_cmf_viewed_at'), 'cmf_sign', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_sign_object_cmf_version'), 'cmf_sign', ['object_cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_sign_parent_id'), 'cmf_sign', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_sign_signed_object_id'), 'cmf_sign', ['signed_object_id'], unique=False)
    op.drop_index('ix_cmf_document_history_cmf_person_sign_left_id', table_name='cmf_document_history_cmf_person_sign')
    op.drop_index('ix_cmf_document_history_cmf_person_sign_parent_id', table_name='cmf_document_history_cmf_person_sign')
    op.drop_index('ix_cmf_document_history_cmf_person_sign_right_id', table_name='cmf_document_history_cmf_person_sign')
    op.drop_index('ix_cmf_document_history_cmf_person_sign_root_id', table_name='cmf_document_history_cmf_person_sign')
    op.drop_table('cmf_document_history_cmf_person_sign')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_document_history_cmf_person_sign',
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['left_id'], ['cmf_document_history.id'], name='cmf_document_history_cmf_person_sign_left_id_fkey'),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_person_sign.id'], name='cmf_document_history_cmf_person_sign_right_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='cmf_document_history_cmf_person_sign_pkey')
    )
    op.create_index('ix_cmf_document_history_cmf_person_sign_root_id', 'cmf_document_history_cmf_person_sign', ['root_id'], unique=False)
    op.create_index('ix_cmf_document_history_cmf_person_sign_right_id', 'cmf_document_history_cmf_person_sign', ['right_id'], unique=False)
    op.create_index('ix_cmf_document_history_cmf_person_sign_parent_id', 'cmf_document_history_cmf_person_sign', ['parent_id'], unique=False)
    op.create_index('ix_cmf_document_history_cmf_person_sign_left_id', 'cmf_document_history_cmf_person_sign', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_sign_signed_object_id'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_parent_id'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_object_cmf_version'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_viewed_at'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_version'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_owner_id'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_owner_assistant_id'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_modified_by_id'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_modified_at'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_locked_by_id'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_locked_at'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_deleted'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_created_at'), table_name='cmf_sign')
    op.drop_index(op.f('ix_cmf_sign_cmf_author_id'), table_name='cmf_sign')
    op.drop_table('cmf_sign')
    op.drop_index(op.f('ix_cmf_document_history_cmf_sign_root_id'), table_name='cmf_document_history_cmf_sign')
    op.drop_index(op.f('ix_cmf_document_history_cmf_sign_right_id'), table_name='cmf_document_history_cmf_sign')
    op.drop_index(op.f('ix_cmf_document_history_cmf_sign_parent_id'), table_name='cmf_document_history_cmf_sign')
    op.drop_index(op.f('ix_cmf_document_history_cmf_sign_left_id'), table_name='cmf_document_history_cmf_sign')
    op.drop_table('cmf_document_history_cmf_sign')
    # ### end Alembic commands ###
