Skip to content

"Repackaging" when upgrading or downgrading #13

Description

@stuyam

I like the pricing_plans methodology with how downgrades don't touch the product but allow you to show a feature is "out of compliance".

However I have a use case where I am packaging based on the number of projects in a users organization. Projects have the ability for the system to mark them as enabled or disabled because the system will keep monitoring and running stuff for those project unless disabled. The way the product currently works is I have a Package::Free package for example. Every package has a #repackage! method on it that is called when the package is set on that organization that allows us to do things like on the free account disable all but one project, or when upgrading, re-enable every project.

My question is, is there an existing way you think this could be accomplished today? Or do you think we could add some sort of hook to the pricing definitions that allows us to call a block of code or some service object to run these changes when a plan is assigned. Maybe like supporting an #after_assign hook?

One disadvantage to this approach is those hooks could change over time leaving some users in different states. But I think that is ok, that is more of a migration issue, and these hooks should be idempotent so they should be able to be called again.

Though I wonder if this creates any other issues with things like the default! plan? I can't tell if the default plan is saved or more of a fallback that is in memory and isn't actually being assigned? Just thinking through some ideas.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions