"""topic unread comment

Revision ID: 4bc1cf49e967
Revises: 0610c65c8b66
Create Date: 2021-10-04 14:05:03.337728

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '4bc1cf49e967'
down_revision = '0610c65c8b66'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_topic_unread_comment',
    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.Integer(), 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('topic_id', sa.String(length=64), nullable=False),
    sa.Column('person_id', sa.String(length=64), nullable=False),
    sa.Column('comment_id', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['comment_id'], ['cmf_comment.id'], ),
    sa.ForeignKeyConstraint(['person_id'], ['cmf_person.id'], ),
    sa.ForeignKeyConstraint(['topic_id'], ['cmf_chat_topic.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_author_id'), 'cmf_topic_unread_comment', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_created_at'), 'cmf_topic_unread_comment', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_deleted'), 'cmf_topic_unread_comment', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_locked_at'), 'cmf_topic_unread_comment', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_locked_by_id'), 'cmf_topic_unread_comment', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_modified_at'), 'cmf_topic_unread_comment', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_modified_by_id'), 'cmf_topic_unread_comment', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_owner_assistant_id'), 'cmf_topic_unread_comment', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_owner_id'), 'cmf_topic_unread_comment', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_version'), 'cmf_topic_unread_comment', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_cmf_viewed_at'), 'cmf_topic_unread_comment', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_comment_id'), 'cmf_topic_unread_comment', ['comment_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_parent_id'), 'cmf_topic_unread_comment', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_person_id'), 'cmf_topic_unread_comment', ['person_id'], unique=False)
    op.create_index(op.f('ix_cmf_topic_unread_comment_topic_id'), 'cmf_topic_unread_comment', ['topic_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cmf_topic_unread_comment_topic_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_person_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_parent_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_comment_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_viewed_at'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_version'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_owner_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_owner_assistant_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_modified_by_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_modified_at'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_locked_by_id'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_locked_at'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_deleted'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_created_at'), table_name='cmf_topic_unread_comment')
    op.drop_index(op.f('ix_cmf_topic_unread_comment_cmf_author_id'), table_name='cmf_topic_unread_comment')
    op.drop_table('cmf_topic_unread_comment')
    # ### end Alembic commands ###
