"""added topic_annotation_excerpts table

Revision ID: ee6af3d06f14
Revises: e876fd9807be
Create Date: 2018-01-31 13:01:41.092052

"""

# revision identifiers, used by Alembic.
revision = 'ee6af3d06f14'
down_revision = 'e876fd9807be'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.schema import Sequence, CreateSequence


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('topic_annotation_excerpts',
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('topic_annotation_id', sa.BigInteger(), nullable=True),
    sa.Column('length', sa.BigInteger(), nullable=True),
    sa.Column('offset', sa.BigInteger(), nullable=True),
    sa.Column('text', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['topic_annotation_id'], ['topic_annotations.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # op.execute(CreateSequence(Sequence('topic_annotation_excerpts_id_seq')))
    op.create_index(op.f('ix_topic_annotation_excerpts_length'), 'topic_annotation_excerpts', ['length'], unique=False)
    op.create_index(op.f('ix_topic_annotation_excerpts_offset'), 'topic_annotation_excerpts', ['offset'], unique=False)
    op.create_index(op.f('ix_topic_annotation_excerpts_topic_annotation_id'), 'topic_annotation_excerpts', ['topic_annotation_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_topic_annotation_excerpts_topic_annotation_id'), table_name='topic_annotation_excerpts')
    op.drop_index(op.f('ix_topic_annotation_excerpts_offset'), table_name='topic_annotation_excerpts')
    op.drop_index(op.f('ix_topic_annotation_excerpts_length'), table_name='topic_annotation_excerpts')
    op.drop_table('topic_annotation_excerpts')
    # ### end Alembic commands ###
