"""cmf_channel_call

Revision ID: 5f2fb59dcb84
Revises: 3152e9aee7a6
Create Date: 2021-09-06 16:48:33.483999

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

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_channel_call',
    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('call_log_raw', sa.TEXT(), nullable=True),
    sa.Column('called_extension', sa.String(length=64), nullable=True),
    sa.Column('called_extension_id', sa.String(length=64), nullable=True),
    sa.Column('caller_extension', sa.String(length=64), nullable=True),
    sa.Column('caller_extension_id', sa.String(length=64), nullable=True),
    sa.Column('event_type', sa.String(length=64), nullable=True),
    sa.Column('call_id', sa.String(length=64), nullable=True),
    sa.Column('caller_id_num', sa.String(length=64), nullable=True),
    sa.Column('caller_id_name', sa.String(length=64), nullable=True),
    sa.Column('call_status', sa.String(length=32), nullable=True),
    sa.Column('call_flow', sa.String(length=32), nullable=True),
    sa.Column('called_number', sa.String(length=64), nullable=True),
    sa.Column('sub_call_id', sa.String(length=64), nullable=True),
    sa.Column('duration', sa.Integer(), nullable=True),
    sa.Column('call_api_id', sa.String(length=64), nullable=True),
    sa.Column('event_time', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('record_path', 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('caller_id', sa.String(length=64), nullable=True),
    sa.Column('channel_id', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_channel_call_caller_id'), 'cmf_channel_call', ['caller_id'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_channel_id'), 'cmf_channel_call', ['channel_id'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_author_id'), 'cmf_channel_call', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_created_at'), 'cmf_channel_call', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_deleted'), 'cmf_channel_call', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_locked_at'), 'cmf_channel_call', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_locked_by_id'), 'cmf_channel_call', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_modified_at'), 'cmf_channel_call', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_modified_by_id'), 'cmf_channel_call', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_owner_assistant_id'), 'cmf_channel_call', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_owner_id'), 'cmf_channel_call', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_version'), 'cmf_channel_call', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_cmf_viewed_at'), 'cmf_channel_call', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_channel_call_parent_id'), 'cmf_channel_call', ['parent_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cmf_channel_call_parent_id'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_viewed_at'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_version'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_owner_id'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_owner_assistant_id'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_modified_by_id'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_modified_at'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_locked_by_id'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_locked_at'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_deleted'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_created_at'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_cmf_author_id'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_channel_id'), table_name='cmf_channel_call')
    op.drop_index(op.f('ix_cmf_channel_call_caller_id'), table_name='cmf_channel_call')
    op.drop_table('cmf_channel_call')
    # ### end Alembic commands ###
