Skip to content

Commit

Permalink
Fix #1305 when plan archived, its new plan has pointer to prior revis…
Browse files Browse the repository at this point in the history
…ion on plan.parent_plan_revision_uuid
  • Loading branch information
chrisjsimpson committed Feb 17, 2024
1 parent b27ffc0 commit 70123ff
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""add parent_plan_revision_uuid to plan
Revision ID: bb76d2149316
Revises: 48074e6225c6
Create Date: 2024-02-16 23:22:02.230866
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "bb76d2149316"
down_revision = "48074e6225c6"
branch_labels = None
depends_on = None


def upgrade():
with op.batch_alter_table("plan", schema=None) as batch_op:
batch_op.add_column(
sa.Column("parent_plan_revision_uuid", sa.String(), nullable=True)
)


def downgrade():
pass
1 change: 1 addition & 0 deletions subscribie/blueprints/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ def edit():
plan_requirements = PlanRequirements()
draftPlan.cancel_at = cancel_at
draftPlan.uuid = str(uuid.uuid4())
draftPlan.parent_plan_revision_uuid = plan.uuid
draftPlan.requirements = plan_requirements
# Preserve primary icon if exists
draftPlan.primary_icon = plan.primary_icon
Expand Down
1 change: 1 addition & 0 deletions subscribie/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ class Plan(database.Model, HasArchived):
id = database.Column(database.Integer(), primary_key=True)
created_at = database.Column(database.DateTime, default=datetime.utcnow)
uuid = database.Column(database.String(), default=uuid_string)
parent_plan_revision_uuid = database.Column(database.String(), default=uuid_string)
title = database.Column(database.String())
description = database.Column(database.String())
interval_unit = database.Column(database.String()) # Charge interval
Expand Down

0 comments on commit 70123ff

Please sign in to comment.