"""channel message fix

Revision ID: 90f02c97b156
Revises: 5f2fb59dcb84
Create Date: 2021-09-06 17:02:02.919900

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '90f02c97b156'
down_revision = '5f2fb59dcb84'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_cmf_channel_message_cmf_import_id', table_name='cmf_channel_message')
    op.drop_index('ix_cmf_channel_message_code', table_name='cmf_channel_message')
    op.drop_index('ix_cmf_channel_message_name', table_name='cmf_channel_message')
    op.drop_constraint('cmf_channel_message_cmf_import_id_fkey', 'cmf_channel_message', type_='foreignkey')
    op.drop_column('cmf_channel_message', 'code')
    op.drop_column('cmf_channel_message', 'cache_last_comments')
    op.drop_column('cmf_channel_message', 'cmf_import_id')
    op.drop_column('cmf_channel_message', 'text')
    op.drop_column('cmf_channel_message', 'system')
    op.drop_column('cmf_channel_message', 'name')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cmf_channel_message', sa.Column('name', sa.VARCHAR(length=256), autoincrement=False, nullable=True))
    op.add_column('cmf_channel_message', sa.Column('system', sa.BOOLEAN(), autoincrement=False, nullable=False))
    op.add_column('cmf_channel_message', sa.Column('text', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('cmf_channel_message', sa.Column('cmf_import_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
    op.add_column('cmf_channel_message', sa.Column('cache_last_comments', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column('cmf_channel_message', sa.Column('code', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
    op.create_foreign_key('cmf_channel_message_cmf_import_id_fkey', 'cmf_channel_message', 'cmf_import', ['cmf_import_id'], ['id'])
    op.create_index('ix_cmf_channel_message_name', 'cmf_channel_message', ['name'], unique=False)
    op.create_index('ix_cmf_channel_message_code', 'cmf_channel_message', ['code'], unique=True)
    op.create_index('ix_cmf_channel_message_cmf_import_id', 'cmf_channel_message', ['cmf_import_id'], unique=False)
    # ### end Alembic commands ###
