Files
notifications-api/migrations/versions/0053_cancelled_job_status.py
Chris Hill-Scott 1bf37888dd Fix mis-matched database migrations
The cancelled job migration originally went in as version `0051`.

But `0051_set_job_status` went in first in
e3fa8bffd7

This meant that Alembic couldn’t work out what order to run the
migrations in, and blew up.

This commit puts the scheduled job migration after all others.
2016-09-06 13:07:20 +01:00

23 lines
597 B
Python

"""empty message
Revision ID: 0053_cancelled_job_status
Revises: 0052_drop_jobs_status
Create Date: 2016-09-01 14:34:06.839381
"""
# revision identifiers, used by Alembic.
revision = '0053_cancelled_job_status'
down_revision = '0052_drop_jobs_status'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
op.execute("INSERT INTO job_status VALUES ('cancelled')")
def downgrade():
op.execute("UPDATE jobs SET job_status = 'finished' WHERE job_status = 'cancelled'")
op.execute("DELETE FROM job_status WHERE name = 'cancelled';")