"""empty message

Revision ID: 7cb95304dbcf
Revises: 8d98ed15b29e
Create Date: 2016-10-23 00:47:18.216000

"""

# revision identifiers, used by Alembic.
revision = '7cb95304dbcf'
down_revision = '8d98ed15b29e'

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

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('citation_screenings', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.alter_column('citation_screenings', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.add_column('citations', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.alter_column('citations', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.add_column('fulltext_screenings', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.alter_column('fulltext_screenings', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.add_column('fulltexts', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.alter_column('fulltexts', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.add_column('fulltexts_extracted_data', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.alter_column('fulltexts_extracted_data', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.add_column('review_plans', sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.add_column('review_plans', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.add_column('reviews', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.alter_column('reviews', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.add_column('users', sa.Column('last_updated', sa.TIMESTAMP(), server_default=sa.text("(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"), nullable=False))
    op.alter_column('users', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.drop_column('users', 'last_updated')
    op.alter_column('reviews', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.drop_column('reviews', 'last_updated')
    op.drop_column('review_plans', 'last_updated')
    op.drop_column('review_plans', 'created_at')
    op.alter_column('fulltexts_extracted_data', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.drop_column('fulltexts_extracted_data', 'last_updated')
    op.alter_column('fulltexts', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.drop_column('fulltexts', 'last_updated')
    op.alter_column('fulltext_screenings', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.drop_column('fulltext_screenings', 'last_updated')
    op.alter_column('citations', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.drop_column('citations', 'last_updated')
    op.alter_column('citation_screenings', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True,
               existing_server_default=sa.text("timezone('UTC'::text, now())"))
    op.drop_column('citation_screenings', 'last_updated')
    ### end Alembic commands ###
