"""Revert migration 1160 temporarily, to add the `application_close_date` column back in.

Revision ID: 1170
Revises: 1160
Create Date: 2018-05-08 09:53:43.699711

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

# revision identifiers, used by Alembic.
revision = '1170'
down_revision = '1160'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('frameworks',
                  sa.Column('application_close_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
    op.alter_column('frameworks', 'intention_to_award_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=True)
    op.alter_column('frameworks', 'framework_live_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=True)
    op.alter_column('frameworks', 'framework_expires_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=True)
    op.alter_column('frameworks', 'clarifications_publish_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=True)
    op.alter_column('frameworks', 'clarifications_close_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=True)
    op.alter_column('frameworks', 'applications_close_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('frameworks', 'applications_close_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=False)
    op.alter_column('frameworks', 'clarifications_close_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=False)
    op.alter_column('frameworks', 'clarifications_publish_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=False)
    op.alter_column('frameworks', 'framework_expires_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=False)
    op.alter_column('frameworks', 'framework_live_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=False)
    op.alter_column('frameworks', 'intention_to_award_at_utc',
                    existing_type=postgresql.TIMESTAMP(),
                    nullable=False)
    op.drop_column('frameworks', 'application_close_date')
    # ### end Alembic commands ###


Revert migration 1160