Potential lifesaver for anyone using MySQL, you can start the client with --i-am-a-dummy to prevent DELETE or UPDATE statements without a WHERE clause: http://sql-info.de/mysql/notes/I-am-a-dummy.html
I Accidentally Deleted All Our Data
51–60 of 78 posts
Re: I Accidentally Deleted All Our Data
#52Potential lifesaver for anyone using MySQL, you can start the client with --i-am-a-dummy to prevent DELETE or UPDATE statements without a WHERE clause: http://sql-info.de/mysql/notes/I-am-a-dummy.html
Why is this not the default, with an option to DISable?
Re: I Accidentally Deleted All Our Data
#53Potential lifesaver for anyone using MySQL, you can start the client with --i-am-a-dummy to prevent DELETE or UPDATE statements without a WHERE clause: http://sql-info.de/mysql/notes/I-am-a-dummy.html
Re: I Accidentally Deleted All Our Data
#54This is a good example of why ACID and declarative constraints are a very good idea for data management.You can do a bad delete from query if you don't have the proper safeguards (though querying ability of SQL lets you more easily preview your changes), but the initial corruption of the data is an easily avoidable problem.
Re: I Accidentally Deleted All Our Data
#55 $ chd version mydb
$ chd revert -d mydb
Neither replication nor backups protect from accidentally deleting data. And restoring from binary logs requires downtime.Re: I Accidentally Deleted All Our Data
#56Re: I Accidentally Deleted All Our Data
#57Earlier quoted context omitted.
It depends, if you're working with a smaller database with a smaller team with a smaller client base, there's not as much harm. There could possibly be more harm in having more ceremony for doing simple things.
I disagree with this. Making a script and testing it against a copy of the database is a good idea in 100% of cases. The only reason you don't do that is because you're lazy and stupid. (I've done this because I'm lazy and stupid.) When you defeat a safety interlock system, expect to be injured.
Even if confident your test passed, what happens when you later realize it hadn't, and at what cost?
Re: I Accidentally Deleted All Our Data
#58Earlier quoted context omitted.
Watch out for database locks if you do this. I once opened a transaction, did an ALTER TABLE, and the site hung until I either committed or rolled back the transaction.
Yeah. Changing the schema is not something I'd do with code running against the database. Also, my database typically refuses to start a transaction if the entire database is locked, and my application handles failing transactions by waiting a while and retrying.
Re: I Accidentally Deleted All Our Data
#59"We had a backup from earlier in the week" week? That seems kind of off. I'd suggest setting up backups more often than that, especially for production data. Sorry to hear about that. I destroyed a drive once a long time ago (~1994) as well. Happens to the best of us.
Because of this, we're going to back up parts of our database more frequently. A lot of our data isn't mission critical, so it wouldn't make sense to do daily backups for it. Other things, like family accounts, obviously are. We're going to back those up daily from here on out.
disk is cheap enough for daily backups and it's simpler to backup everything than make a big project out of slicing and dicing your backup script.
Re: I Accidentally Deleted All Our Data
#60One of my first perl scripts (c'mon. it was 12 years ago) was to adjust something about user accounts. I dont remember what it was, just that the result was deleting the home folder of every single teacher at the school.
a very honest mistake.