<reponame>project-origin/example-backend
"""empty message

Revision ID: ae99f87c0e75
Revises: <KEY>
Create Date: 2020-05-18 19:16:45.456286

"""
from alembic import op
from sqlalchemy import orm
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ae99f87c0e75'
down_revision = '<KEY>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('agreements_agreement', sa.Column('cancelled', sa.DateTime(timezone=True), nullable=True))
    op.add_column('agreements_agreement', sa.Column('declined', sa.DateTime(timezone=True), nullable=True))
    # ### end Alembic commands ###

    op.execute("UPDATE agreements_agreement AS a SET cancelled = NOW() WHERE a.state = 'CANCELLED'")
    op.execute("UPDATE agreements_agreement AS a SET declined = NOW() WHERE a.state = 'DECLINED'")


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('agreements_agreement', 'declined')
    op.drop_column('agreements_agreement', 'cancelled')
    # ### end Alembic commands ###

"""empty message

Revision ID: ae99f87c0e75
Revises: <KEY>
Create Date: 2020-05-18 19:16:45.456286

"""
from alembic import op
from sqlalchemy import orm
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ae99f87c0e75'
down_revision = '<KEY>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('agreements_agreement', sa.Column('cancelled', sa.DateTime(timezone=True), nullable=True))
    op.add_column('agreements_agreement', sa.Column('declined', sa.DateTime(timezone=True), nullable=True))
    # ### end Alembic commands ###

    op.execute("UPDATE agreements_agreement AS a SET cancelled = NOW() WHERE a.state = 'CANCELLED'")
    op.execute("UPDATE agreements_agreement AS a SET declined = NOW() WHERE a.state = 'DECLINED'")


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('agreements_agreement', 'declined')
    op.drop_column('agreements_agreement', 'cancelled')
    # ### end Alembic commands ###
empty message  Revision ID: ae99f87c0e75 Revises: <KEY> Create Date: 2020-05-18 19:16:45.456286 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###