Skip to content
Snippets Groups Projects

Feature/cancel initial subscriptions

Merged Karel van Klink requested to merge feature/cancel-inital-subscriptions into develop
3 files
+ 50
3
Compare changes
  • Side-by-side
  • Inline
Files
3
"""Add subscription cancellation workflow.
Revision ID: 734e36a3e70b
Revises: d61c0f92da1e
Create Date: 2024-03-21 13:03:08.981028
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '734e36a3e70b'
down_revision = 'd61c0f92da1e'
branch_labels = None
depends_on = None
from orchestrator.migrations.helpers import add_products_to_workflow_by_product_tag, create_workflow, delete_workflow, remove_products_from_workflow_by_product_tag
products = ["RTR", "IPTRUNK"]
new_workflows = [
{
"name": "cancel_subscription",
"target": "TERMINATE",
"description": "Cancel a subscription",
"product_type": "Site"
}
]
def upgrade() -> None:
conn = op.get_bind()
for workflow in new_workflows:
create_workflow(conn, workflow)
for product_tag in products:
add_products_to_workflow_by_product_tag(conn, "cancel_subscription", product_tag)
def downgrade() -> None:
conn = op.get_bind()
for product_tag in products:
remove_products_from_workflow_by_product_tag(conn, "cancel_subscription", product_tag)
for workflow in new_workflows:
delete_workflow(conn, workflow["name"])
Loading