Add foreign keys with cascade delete for zuora cache DB tables
Problem
A suggestion from a recent MR review was about dependent destroys for associations in the new Zuora cache models (Zuora::RatePlan
, Zuora::RatePlanCharge
, and Zuora::RatePlanCharge
).
Proposal
It would be better to define these columns in the DB as foreign keys with cascading deletes. If a Zuora::Subscription
is ever removed (which might be very rare), there is no need to keep the orphaned data from the associated tables. Using cascade deletes in the DB is preferred to using dependent destroys defined in the model.