30 lines
793 B
Python
30 lines
793 B
Python
"""add after_completion unit
|
|
|
|
Revision ID: 0021_after_completion_unit
|
|
Revises: 0020_calendar_subscriptions
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "0021_after_completion_unit"
|
|
down_revision = "0020_calendar_subscriptions"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("recurrence_templates") as batch_op:
|
|
batch_op.add_column(
|
|
sa.Column("after_completion_unit", sa.String(length=8), nullable=True)
|
|
)
|
|
op.execute(
|
|
"UPDATE recurrence_templates SET after_completion_unit = 'days' "
|
|
"WHERE trigger_mode = 'after_completion'"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("recurrence_templates") as batch_op:
|
|
batch_op.drop_column("after_completion_unit")
|