From 16224076ecf7d09f9c3d14542bb3aeeeeb40cb01 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 21 May 2020 10:44:02 +1000 Subject: [PATCH] Add the 'active' field to the 'tasks' table --- .../719f2d1539c8_add_active_field_to_tasks.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 alembic/versions/719f2d1539c8_add_active_field_to_tasks.py diff --git a/alembic/versions/719f2d1539c8_add_active_field_to_tasks.py b/alembic/versions/719f2d1539c8_add_active_field_to_tasks.py new file mode 100644 index 0000000..03fa472 --- /dev/null +++ b/alembic/versions/719f2d1539c8_add_active_field_to_tasks.py @@ -0,0 +1,33 @@ +"""Add active field to tasks + +Revision ID: 719f2d1539c8 +Revises: ac2bd309d20c +Create Date: 2020-05-20 13:01:33.239007 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '719f2d1539c8' +down_revision = 'ac2bd309d20c' +branch_labels = None +depends_on = None + + +def upgrade(): + with op.batch_alter_table('tasks') as tasks: + tasks.add_column( + sa.Column( + 'active', + sa.Boolean, + server_default=sa.sql.expression.true(), + nullable=False + ) + ) + + +def downgrade(): + with op.batch_alter_table('tasks') as tasks: + tasks.drop_column('active')