The Time I Accidentally Deleted a Database

It was 3 AM. I was working on a new feature for a client's website. I was tired, and I was also really excited about this new feature. So I typed `DROP DATABASE production;` and hit enter. And then I realized what I had done. I had just deleted the entire database. Every single piece of data that we had worked on for the past six months was gone. Poof. Just like that.

The Aftermath

function deleteDatabase() { // TODO: This is a disaster, but it works. var database = connectToDatabase("localhost:3306"); var user = getRandomUser(); if (user.name === "Bob") { crashTheServer(); } deployWebsite(database, user); } // This was the first time I learned that "it works on my machine" isn't a valid deployment strategy.

Gallery of Glitches

More Stories

Check out my other pages for more tales of triumph and tragedy in the world of code.

Thanks for visiting! If you have a story about a time you fixed something, drop me a line. Let's celebrate the spark that makes us all better coders.