is deletion actually a thing or just formality in production?

Let's take shopify as an example, if a product is deleted, and as they claim deleted product can't be restored, how do they do their stats and other things related to orders Because the relationships in database will be Product -> Orders So technically if a product is deleted orders is supposed to be cascade deleted Or they have a boolean were on delete it sets thr product to deleted 😅 (or how do you handle such cases at work) Or will Orders be an Orhan were the relationship will be null on product deletion
9 Replies
Alex
Alex•6mo ago
In my company we have a boolean deleted for every table which we just set to true if we want to delete it. I think doing a hard delete has it’s reasons sometimes too
Lopen
Lopen•6mo ago
But i am looking at the excess package involved in storing it (cost) Maybe that's why companies have terabytes/petabytes of data And also the performance cost Lets say
select user a
select user a
was supposed to go over 1 million columns but since nothing is actually deleted it may now go over 10 million
Alex
Alex•6mo ago
Indeed. If you don’t need the data for statistics or whatever it’s better to be hard deleted In case of shopify for example the payment and order data should probably be saved for legal reasons or something maybe
Lopen
Lopen•6mo ago
who does not need statistics? 😉 exactly my thought but then why is no one coming clean about it
averagedev999
averagedev999•6mo ago
i hate soft deletes too but most clients prefer it over hard deletes so users can restore data just in case Implementing reliable soft deletes properly is a pain 😭
Lopen
Lopen•6mo ago
whenever I hear "soft delete" Laravel comes to mind I have never seen anyone in Laravel do a hard delete
averagedev999
averagedev999•6mo ago
i never used laravel but i heard good things 🥹
Lopen
Lopen•6mo ago
Lambo right?
averagedev999
averagedev999•6mo ago
lambo and a house 🥹 at least i get to walk and train my legs