"""remove_cmf_event

Revision ID: 9238020169c5
Revises: c871119880b0
Create Date: 2021-02-18 13:27:26.269463

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

# revision identifiers, used by Alembic.
revision = '9238020169c5'
down_revision = 'c871119880b0'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_cmf_feed_cmf_event_left_id', table_name='cmf_feed_cmf_event')
    op.drop_index('ix_cmf_feed_cmf_event_right_id', table_name='cmf_feed_cmf_event')
    op.drop_table('cmf_feed_cmf_event')
    op.drop_index('ix_cmf_event_cmf_author_id', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_created_at', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_deleted', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_locked_at', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_locked_by_id', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_modified_at', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_modified_by_id', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_owner_id', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_version', table_name='cmf_event')
    op.drop_index('ix_cmf_event_cmf_viewed_at', table_name='cmf_event')
    op.drop_index('ix_cmf_event_code', table_name='cmf_event')
    op.drop_index('ix_cmf_event_event_alarm_date', table_name='cmf_event')
    op.drop_index('ix_cmf_event_event_person_id', table_name='cmf_event')
    op.drop_index('ix_cmf_event_event_person_type', table_name='cmf_event')
    op.drop_index('ix_cmf_event_event_status', table_name='cmf_event')
    op.drop_index('ix_cmf_event_msg_alarm_date', table_name='cmf_event')
    op.drop_index('ix_cmf_event_msg_orderno', table_name='cmf_event')
    op.drop_index('ix_cmf_event_name', table_name='cmf_event')
    op.drop_index('ix_cmf_event_object_code', table_name='cmf_event')
    op.drop_index('ix_cmf_event_object_id', table_name='cmf_event')
    op.drop_index('ix_cmf_event_unread_cnt', table_name='cmf_event')
    op.drop_index('ix_cmf_event_view_object_code', table_name='cmf_event')
    op.drop_index('ix_cmf_event_view_object_id', table_name='cmf_event')
    op.drop_table('cmf_event')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_event',
    sa.Column('cmf_author_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('cmf_created_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
    sa.Column('cmf_deleted', sa.BOOLEAN(), autoincrement=False, nullable=False),
    sa.Column('cmf_locked_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('cmf_locked_by_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('cmf_modified_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
    sa.Column('cmf_modified_by_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('cmf_owner_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('cmf_version', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('cmf_viewed_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('code', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('event_alarm_date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('event_person_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('event_person_type', sa.VARCHAR(length=32), autoincrement=False, nullable=True),
    sa.Column('event_status', sa.VARCHAR(length=32), autoincrement=False, nullable=True),
    sa.Column('event_stick', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('event_ui_targets', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('msg_alarm_date', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('msg_body', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('msg_class', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('msg_from', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('msg_icon', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('msg_important', sa.VARCHAR(length=32), autoincrement=False, nullable=False),
    sa.Column('msg_orderno', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('msg_penalty', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('msg_status', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('msg_subject', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('msg_to', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('msg_url', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('name', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('object_code', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('object_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('text', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('unread_cnt', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('view_object_code', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('view_object_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['event_person_id'], ['cmf_person.id'], name='cmf_event_event_person_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='cmf_event_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_index('ix_cmf_event_view_object_id', 'cmf_event', ['view_object_id'], unique=False)
    op.create_index('ix_cmf_event_view_object_code', 'cmf_event', ['view_object_code'], unique=False)
    op.create_index('ix_cmf_event_unread_cnt', 'cmf_event', ['unread_cnt'], unique=False)
    op.create_index('ix_cmf_event_object_id', 'cmf_event', ['object_id'], unique=False)
    op.create_index('ix_cmf_event_object_code', 'cmf_event', ['object_code'], unique=False)
    op.create_index('ix_cmf_event_name', 'cmf_event', ['name'], unique=False)
    op.create_index('ix_cmf_event_msg_orderno', 'cmf_event', ['msg_orderno'], unique=False)
    op.create_index('ix_cmf_event_msg_alarm_date', 'cmf_event', ['msg_alarm_date'], unique=False)
    op.create_index('ix_cmf_event_event_status', 'cmf_event', ['event_status'], unique=False)
    op.create_index('ix_cmf_event_event_person_type', 'cmf_event', ['event_person_type'], unique=False)
    op.create_index('ix_cmf_event_event_person_id', 'cmf_event', ['event_person_id'], unique=False)
    op.create_index('ix_cmf_event_event_alarm_date', 'cmf_event', ['event_alarm_date'], unique=False)
    op.create_index('ix_cmf_event_code', 'cmf_event', ['code'], unique=True)
    op.create_index('ix_cmf_event_cmf_viewed_at', 'cmf_event', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_event_cmf_version', 'cmf_event', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_event_cmf_owner_id', 'cmf_event', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_event_cmf_modified_by_id', 'cmf_event', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_event_cmf_modified_at', 'cmf_event', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_event_cmf_locked_by_id', 'cmf_event', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_event_cmf_locked_at', 'cmf_event', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_event_cmf_deleted', 'cmf_event', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_event_cmf_created_at', 'cmf_event', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_event_cmf_author_id', 'cmf_event', ['cmf_author_id'], unique=False)
    op.create_table('cmf_feed_cmf_event',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_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_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['left_id'], ['cmf_feed.id'], name='cmf_feed_cmf_event_left_id_fkey'),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_event.id'], name='cmf_feed_cmf_event_right_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='cmf_feed_cmf_event_pkey')
    )
    op.create_index('ix_cmf_feed_cmf_event_right_id', 'cmf_feed_cmf_event', ['right_id'], unique=False)
    op.create_index('ix_cmf_feed_cmf_event_left_id', 'cmf_feed_cmf_event', ['left_id'], unique=False)
    # ### end Alembic commands ###
