News for hackers. Stuff that matters.
Re:An administrator accidentally deleted the production data... by blakeyrat on Wednesday March 23, 2016 @07:20PM (#11349165)
I had a great mentor who taught me all the safety mechanisms.

Start your .sql file with "use xxxxx" (non-existent database name; will prevent execution if you fat-finger F5.) Always write your deletes as a SELECT first:

SELECT *

-- delete

FROM blah

WHERE blah = 1

Never uncomment the "delete" line; just select the portion of the query after the comment with your mouse and F5 it.

And of course: always design your database with support for soft-deletes, because sooner or later you'll need to add them in.

There are no comments on this comment yet.