Live data from Hacker News

I Accidentally Deleted All Our Data

taylor.fausak.me

1–10 of 78 posts

Re: I Accidentally Deleted All Our Data

#3
I've done this a few times in my career. I'm smart enough now to always backup before I make any potential mistakes and test everything on a staging server.

The worst was executing "DELETE FROM " instead of "DELETE FROM where userid='X' on a production server.

Re: I Accidentally Deleted All Our Data

#4
post #3

I've done this a few times in my career. I'm smart enough now to always backup before I make any potential mistakes and test everything on a staging server. The worst was executing "DELETE FROM " instead of "DELETE FROM where userid='X' on a production server.

I once updated every user's password to "prettyflowers" or something dumb like that while trying to reset one customer's password.

I realized what I did the instant I hit enter, and all the blood drained from my face.

Thank god for backups.

Re: I Accidentally Deleted All Our Data

#5
Ha, this is actually pretty funny in retrospect. There I was, giving a talk on all of this great stuff we do with our data, having no idea that a good portion of that data had just vanished. The universe has many potent mechanisms for keeping us humble.

Re: I Accidentally Deleted All Our Data

#6
Although direct database update isn't recommended in SAP, still for some strange reasons it was needed in one of the projects to modify a wrong entry done by functional consultant. One of my fellow programmer was assigned this task and this is what she did -

Update set =

instead of

Update set = where

The code was executed on development server(thankfully) and it created a big mess. Full day work of 5 guys was lost. Project Manager banned her from developing any critical program and told her she will only write abap/4 reports from then onwards.

Re: I Accidentally Deleted All Our Data

#7
Happy to hear that you had backups and not too much data was lost because you caught it quickly.

But besides the obvious takeaway of always having recent, tested backups, I think it's also important to get out of the habit of ever using a REPL (or SSH for that matter) to connect to production servers. Write a one-off script, document when and why you made it, check it into your VCS of choice, and run it against the target server(s). Of course within the script itself feel free to make any connections you need; my point is to never do it "manually" from the command-line. This also prepares you for when you move past having a single live server for web or db. If you're in Python-land, Fabric is the go-to tool these days for automating this.

Re: I Accidentally Deleted All Our Data

#8
post #6

Although direct database update isn't recommended in SAP, still for some strange reasons it was needed in one of the projects to modify a wrong entry done by functional consultant. One of my fellow programmer was assigned this task and this is what she did - Update set = instead of Update set = where The code was executed on development server(thankfully) and it created a big mess. Full day work of 5 guys was lost. P…

Sounds like a poor manager to me.

Re: I Accidentally Deleted All Our Data

#9

Happy to hear that you had backups and not too much data was lost because you caught it quickly. But besides the obvious takeaway of always having recent, tested backups, I think it's also important to get out of the habit of ever using a REPL (or SSH for that matter) to connect to production servers. Write a one-off script, document when and why you made it, check it into your VCS of choice, and run it against the t…

I usually write my scripts in a temporary file and run them through Django with something like:

    $ python manage.py shell 
In this instance, I didn't even consider that what I was doing could be catastrophic. But you're right, you want to avoid doing things manually. In the future, I'll track all the scripts I run. And thanks for the tip about Fabric, I'll check it out.

Re: I Accidentally Deleted All Our Data

#10
post #8
post #6

Although direct database update isn't recommended in SAP, still for some strange reasons it was needed in one of the projects to modify a wrong entry done by functional consultant. One of my fellow programmer was assigned this task and this is what she did - Update set = instead of Update set = where The code was executed on development server(thankfully) and it created a big mess. Full day work of 5 guys was lost. P…

Sounds like a poor manager to me.

Yes. He was a poor manager. He was actually a hard core marketing/sales guy with limited people(developer) management skills.
Post reply on HN