From 31de10ae6f7d784073e7e8eb894bd0db9760ef90 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Mon, 16 Jan 2017 11:19:46 +0000 Subject: [PATCH] dB script to default templates/templates_history.process_type = 'normal' and set the column to not null --- .../0064_update_template_process_type.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 migrations/versions/0064_update_template_process_type.py diff --git a/migrations/versions/0064_update_template_process_type.py b/migrations/versions/0064_update_template_process_type.py new file mode 100644 index 000000000..25df98fdc --- /dev/null +++ b/migrations/versions/0064_update_template_process_type.py @@ -0,0 +1,34 @@ +"""empty message + +Revision ID: 0064_update_template_process_type +Revises: 0063_templates_process_type +Create Date: 2017-01-16 11:08:00.520678 + +""" + +# revision identifiers, used by Alembic. +revision = '0064_update_template_process' +down_revision = '0063_templates_process_type' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.execute("Update templates set process_type = 'normal'") + op.execute("Update templates_history set process_type = 'normal'") + op.alter_column('templates', 'process_type', + existing_type=sa.VARCHAR(length=255), + nullable=False) + op.alter_column('templates_history', 'process_type', + existing_type=sa.VARCHAR(length=255), + nullable=False) + + +def downgrade(): + op.alter_column('templates_history', 'process_type', + existing_type=sa.VARCHAR(length=255), + nullable=True) + op.alter_column('templates', 'process_type', + existing_type=sa.VARCHAR(length=255), + nullable=True)