"""Remove activity, archiving and investigation features

Revision ID: e9430e3e444f
Revises: 19f878f363bf
Create Date: 2017-08-21 17:50:14.305453

"""

# revision identifiers, used by Alembic.
revision = 'e9430e3e444f'
down_revision = '19f878f363bf'

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

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('activity')
    op.drop_column('session', 'archived')
    op.drop_column('session', 'investigated')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('session', sa.Column('investigated', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=True))
    op.add_column('session', sa.Column('archived', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False))
    op.create_table('activity',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('action', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('timestamp', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True),
    sa.Column('test_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('session_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['session_id'], ['session.id'], name='activity_session_id_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['test_id'], ['test.id'], name='activity_test_id_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='activity_user_id_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='activity_pkey')
    )
    # ### end Alembic commands ###
