From f021456b0a3b41fbc6349ca5d66d41b8fc2da5e6 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 14 2016 14:19:36 +0000 Subject: Delete the old status only at the end --- diff --git a/alembic/versions/644ef887bb6f_add_close_status.py b/alembic/versions/644ef887bb6f_add_close_status.py index 9a20a41..b9407b8 100644 --- a/alembic/versions/644ef887bb6f_add_close_status.py +++ b/alembic/versions/644ef887bb6f_add_close_status.py @@ -51,15 +51,15 @@ def upgrade(): session.add(ticket_stat) session.commit() - # Remove the old status - op.execute('''DELETE FROM "status_issue" WHERE "status" NOT IN ('Open', 'Closed'); ''') - # Set the close_status for all the closed tickets op.execute('''UPDATE "issues" SET "close_status"=status where status != 'Open'; ''') # Mark all the tickets as closed op.execute('''UPDATE "issues" SET status='Closed' where status != 'Open'; ''') + # Remove the old status + op.execute('''DELETE FROM "status_issue" WHERE "status" NOT IN ('Open', 'Closed'); ''') + def downgrade(): ''' Add the column _close_status to the table projects.