Add employee engagement pause and dependency workflow phase 3

This commit is contained in:
A R R R Associates
2026-07-20 00:31:29 +05:30
parent dfdc74b534
commit 031c278e8f
6 changed files with 233 additions and 34 deletions
@@ -0,0 +1,32 @@
"""Add employee engagement workflow pause metadata.
Revision ID: 20260719_employee_workflow_phase3
Revises: 20260719_task_checklist_fields
"""
from alembic import op
import sqlalchemy as sa
revision = "20260719_employee_workflow_phase3"
down_revision = "20260719_task_checklist_fields"
branch_labels = None
depends_on = None
def upgrade():
op.add_column("client_service_subscriptions", sa.Column("workflow_pause_reason", sa.String(length=60), nullable=True))
op.add_column("client_service_subscriptions", sa.Column("workflow_pause_notes", sa.Text(), nullable=True))
op.add_column("client_service_subscriptions", sa.Column("workflow_follow_up_date", sa.Date(), nullable=True))
op.add_column("client_service_subscriptions", sa.Column("workflow_paused_at_utc", sa.DateTime(timezone=True), nullable=True))
op.add_column("client_service_subscriptions", sa.Column("workflow_paused_by_user_id", sa.Integer(), nullable=True))
op.add_column("client_service_subscriptions", sa.Column("workflow_resumed_at_utc", sa.DateTime(timezone=True), nullable=True))
op.add_column("client_service_subscriptions", sa.Column("workflow_resumed_by_user_id", sa.Integer(), nullable=True))
op.create_index("ix_client_service_subscriptions_workflow_pause_reason", "client_service_subscriptions", ["workflow_pause_reason"])
op.create_index("ix_client_service_subscriptions_workflow_follow_up_date", "client_service_subscriptions", ["workflow_follow_up_date"])
op.create_index("ix_client_service_subscriptions_workflow_paused_by_user_id", "client_service_subscriptions", ["workflow_paused_by_user_id"])
op.create_index("ix_client_service_subscriptions_workflow_resumed_by_user_id", "client_service_subscriptions", ["workflow_resumed_by_user_id"])
op.create_foreign_key("fk_css_workflow_paused_by_user", "client_service_subscriptions", "users", ["workflow_paused_by_user_id"], ["id"], ondelete="SET NULL")
op.create_foreign_key("fk_css_workflow_resumed_by_user", "client_service_subscriptions", "users", ["workflow_resumed_by_user_id"], ["id"], ondelete="SET NULL")
def downgrade():
op.drop_constraint("fk_css_workflow_resumed_by_user", "client_service_subscriptions", type_="foreignkey")
op.drop_constraint("fk_css_workflow_paused_by_user", "client_service_subscriptions", type_="foreignkey")
for name in ["ix_client_service_subscriptions_workflow_resumed_by_user_id","ix_client_service_subscriptions_workflow_paused_by_user_id","ix_client_service_subscriptions_workflow_follow_up_date","ix_client_service_subscriptions_workflow_pause_reason"]: op.drop_index(name, table_name="client_service_subscriptions")
for name in ["workflow_resumed_by_user_id","workflow_resumed_at_utc","workflow_paused_by_user_id","workflow_paused_at_utc","workflow_follow_up_date","workflow_pause_notes","workflow_pause_reason"]: op.drop_column("client_service_subscriptions", name)