mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Remove the status column from jobs, and update the new job status column with the previous values
This commit is contained in:
committed by
Chris Hill-Scott
parent
668e6c9716
commit
6488feaeec
22
migrations/versions/0049_set_job_status.py
Normal file
22
migrations/versions/0049_set_job_status.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0049_set_job_status
|
||||
Revises: 0048_job_scheduled_time
|
||||
Create Date: 2016-08-24 13:21:51.744526
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0049_set_job_status'
|
||||
down_revision = '0048_job_scheduled_time'
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("update jobs set job_status = status where job_status is null")
|
||||
pass
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
||||
28
migrations/versions/0050_drop_jobs_status.py
Normal file
28
migrations/versions/0050_drop_jobs_status.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0050_drop_jobs_status
|
||||
Revises: 0049_set_job_status
|
||||
Create Date: 2016-08-25 15:56:31.779399
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0050_drop_jobs_status'
|
||||
down_revision = '0049_set_job_status'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('jobs', 'job_status',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.drop_column('jobs', 'status')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.add_column('jobs', sa.Column('status', postgresql.ENUM('pending', 'in progress', 'finished', 'sending limits exceeded', name='job_status_types'), autoincrement=False, nullable=False))
|
||||
op.alter_column('jobs', 'job_status',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=True)
|
||||
Reference in New Issue
Block a user