DEV Community

Discussion on: What's the worst code you've ever written?

Collapse
 
krtobias profile image
Tobias Krause

A SQL script that deletes all tables, views, everything.
Executed by mistake (my first days at work).
My mates pranked me.

Collapse
 
jrothlander profile image
jrothlander • Edited

I remember do something similar in UNIX scripting where you delete all the files on a system. The way you figure out who did it was that the only remaining account left on the system was theirs, as you cannot delete your own account. That was always fun. Even more fun when one of the backups failed.

Collapse
 
ben profile image
Ben Halpern

Wait so they pranked you into writing the script and executing? Can you expand on the story?

Collapse
 
krtobias profile image
Tobias Krause

Well I was a trainee (German system) and it was my first month or so. My trainer just wanted to show me some cool stuff on a dummy database. Sadly though the DB software was still connected to the main db. So yeah I deleted main. Of course our admins had backups but still ... Yikes