6

TIFU by running DELETE-INSERT on a live server and losing thousands of rows from a separate table. 🤤

TIL If you delete data from indexed table, it will affect any linked tables. I think. Fml. 🤕

At least it was a learning experience for all of us. Hopefully if I keep repeating it enough it will become true...

Comments
  • 0
    Triple check.
    And run in staging first.
    Always.
  • 1
    Yeah, doesn't have to do with indexes but with foreign keys...

    They were probably set to "ON DELETE CASCADE" which just means, if the parent dies, kill all records associated with it :p
  • 1
    @FMashiro yep. Figured it out the next day, we found out there are 72 cascades across the database from when the company got the bespoke web and db, miracle no one tripped it prior since they're pretty lenient with the use of DELETE-INSERT.

    Bonus: our entire server was down the past two days and no one knows why. House of cards my friend...
Add Comment