Add the 'active' field to the 'tasks' table

This commit is contained in:
Danny Robson 2020-05-21 10:44:02 +10:00
parent de96bfee15
commit 16224076ec

View File

@ -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')