Howdy, is there any smart reason, why `SolidusSubs...
# support
j
Howdy, is there any smart reason, why
SolidusSubscriptions::Subscription
does not have
dependent: destroy
on some of its child models, like
Installment
or
InstallmentDetail
? I figure maybe just an oversight but perhaps someone has a smart reason for this.
e
I'm not aware of any, most likely an oversight 👍
j
Ok get ready for a PR!
❤️ 1
n
Not sure how smart this is but I believe they decided that it didn't make sense to have dependent: destroy on the child models because the data in those models is needed for the parent model. If you delete the child models, then the parent model won't have the data it needs.
j
I haven’t done this for awhile so forgive my innocence but I thought this will allow cascading `destroy`s? So If a subscription is destroyed, so will the installment, events, and installment details?
n
If the child models are destroyed, then the parent model won't have the data it needs. For example, if the installments are destroyed, then the subscription won't know how much it owes.
j
Yeah I get that.
I just want to implement cascading destroys when I destroy a subscription
n
I see what you're saying. You plan on adding the dependent:destroy to the child models.
Migration from one subscription to another may be an issue though...
j
Yes my bad!
n
Also if you delete a subscription by mistake that may be an issue.
Well that's an issue regardless...
If you have a lot of child models too that would be a lot of data to delete.
If you make the mistake of deleting the parent without deleting the children you could have some issues with data as well.
That would be difficult to troubleshoot.
^^ since the parents deleted.
Will any of your subscriptions share the same child models?
You could end up deleting a shared child model by mistake. I'm a Shopify developer so I could be wrong. I have a client who's planning to migrate to Solidus so I'm checking it out.