"""Add warning deduplication

Revision ID: f0bfc3f425c7
Revises: ad9b81f99615
Create Date: 2017-10-15 13:37:53.475324

"""

# revision identifiers, used by Alembic.
revision = 'f0bfc3f425c7'
down_revision = 'ad9b81f99615'

from alembic import op
import sqlalchemy as sa


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('warning', sa.Column('num_warnings', sa.Integer(), nullable=True))
    op.create_index('ix_warning_details', 'warning', ['session_id', 'test_id', 'filename', 'lineno'], unique=False, postgresql_where=sa.text('session_id IS NULL'))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_warning_details', table_name='warning')
    op.drop_column('warning', 'num_warnings')
    # ### end Alembic commands ###
