DEV Community

Hazmi Irfan
Hazmi Irfan

Posted on

I delete my live prod database and have no backup

Welp. That just happen. I just deleted my live production database and I don't have a backup.

Yesterday I completed my new website Logname and decided to tell everyone I can about the website(Reddit, Hackernews etc).

After a day has passed, I want to see how many people register. Me being lazy without admin interface I figured I can login to postgres and query it directly.

I hosted it on heroku so I can just use this command heroku pg:psql <database-name> --app <app-name>

I already run this on terminal so I quickly go to previous history and press enter when I see pg command.

I forgot that earlier I had run this command heroku pg:reset <database-name> --confirm <app-name>

So now my database has successfully reset and I have lost all of my user if any.

Honestly I am mad as hell right now and I feel ashamed to people who tried to use my website.

One of the reason I build this website is so that user can rely on this website to maintain their info for a long time because resume is not something u need often but urgent when needed.

To all who register to give the website a try, I'm really sorry but you need to register and insert the data again but rest assured that this won't happen again.

Top comments (31)

Collapse
 
volxz profile image
Ethan Gallant

Before you smack the enter button on a dangerous command, add a space to the start.

It will make sure the command isn't saved in history.

Collapse
 
nickfotopoulos profile image
Nick Fotopoulos

I didn't know this was a thing....ty!

Collapse
 
tehaisperlis profile image
Hazmi Irfan

I wish I know this earlier. Thanks!

Collapse
 
nubunto profile image
Bruno Luis Panuto Silva

this is gold!!!

Collapse
 
nickfotopoulos profile image
Nick Fotopoulos • Edited

Ouch! 😥 Lots of us know this feel all too well. Welcome to the club. 🤭

Here is a song to commemorate this thing you learned today....

"Everybody's gotta learn some time..."
youtu.be/gkH3LpvOo0U

Collapse
 
tehaisperlis profile image
Hazmi Irfan

haha thanks.

BTW that movie is one of my favourite.

Collapse
 
byllc profile image
Bill Chapman

I had a client come to me years ago who had done this same thing after a product launch and a heavy round of user registrations. I was able to reproduce a significant amount of registration data by parsing it out of the request logs generated by the framework they were using and the proxy in front of it. We were able to get usernames and email addresses, recreate the accounts and send an email asking everyone to reset their passwords.

You may be able to do something similar depending on your stack. Good Luck.

Collapse
 
tehaisperlis profile image
Hazmi Irfan

Never thought about using the log. Will try and see what I can salvage. At the very least I can email them individually.

Thanks!

Collapse
 
tamimi profile image
Tim

Oh man. That suuuuuucks. I'm sorry that happened! 😟 Especially right after posting about it on Reddit etc, that must've been quite the gut punch.

It's a super easy mistake to make - I think all you can do is learn from it to double check what's in the terminal before smoshing Enter but I think sometimes that sort of thing just happens.

On that note, I highly recommend Digital Ocean for hosting your apps when you're getting to the stage where you are now, as you're clearly moving into production.

Heroku is fun and easy to set up for hobbyist projects, but isn't cost effective in the long term if you plan on scaling Logname upwards as a business.

I mention DO in particular is because I love their automatic weekly backups service on Databases, especially because of the super clear pricing whereby the backups cost a flat 20% on top of your basic rate.

Shamelessly plugging my referral link: m.do.co/c/31c29b0c4e37 <-- You get $100 USD in DO credits using this link.

Good luck out there.

Collapse
 
tehaisperlis profile image
Hazmi Irfan

I actually used DO before but I found Heroku much easier to start with. I agree the price is expensive when you scale up but I have never need to do it in the first place.

Hopefully that will change soon!.

Thanks for the referral link. Will keep that when I used DO the next time.

Collapse
 
nubunto profile image
Bruno Luis Panuto Silva

I'm sorry this happened to you. But at the same time, you learned with it. Nothing I write here will drive the feeling away from you though.

Wishing luck for you and Logname! PS: I love it and I'll probably start using it ;)

Collapse
 
aa profile image
Aleksandr

Is the project open sourced?
Is there a way to contribute?

Collapse
 
tehaisperlis profile image
Hazmi Irfan

Unfortunately no. I'm not sure what to do with the project yet but I will let you know if it is open sourced.

Collapse
 
codingbash profile image
Basheer Becerra

Yeah I one time deleted my production database because my ORM configuration (copied from Stack Overflow) had a setting to wipe the database (since it assumed it was an in-memory development instance lol). Luckily AWS had automatic backups but I’m pretty sure I almost had a heart attack.

Collapse
 
tehaisperlis profile image
Hazmi Irfan • Edited

Yeah I definitely know the feeling!

Collapse
 
scalawilliam profile image
William Narmontas

For anything important, I recommend Google Cloud SQL. Has restore options and many other features available.

I was very concerned with using Postgresql provided by Heroku because Heroku would often move the database out on top of their fairly expensive pricing and low transparency what is going on in your DB. I looked at other solutions and Google was the most comprehensive. I'm using it for my website scala-algorithms.com (PG 13)

Collapse
 
coderslang profile image
Coderslang: Become a Software Engineer

You live and you learn...

Collapse
 
tehaisperlis profile image
Hazmi Irfan

True!

Collapse
 
oknoorap profile image
Ribhararnus Pracutian

Amazing experience you have in your life as developer 😆. Good luck!

Collapse
 
tehaisperlis profile image
Hazmi Irfan

One of many!

Collapse
 
oben profile image
OBen

Sorry for you, mate. I guess this was your last time without automatic backup. You’ve definitely learned the lesson in a hard way.

Collapse
 
tehaisperlis profile image
Hazmi Irfan

Yeah. As the other commenter said "You live and you learn".

Collapse
 
rafipiccolo profile image
Raphael Piccolo

😂😂 happens to me once a year.
But after the first one I had working backups.
Also don't forget to test your backups if you do some. One incomplete backup is not enough. Happened once too...

Collapse
 
tehaisperlis profile image
Hazmi Irfan

Will do. Thanks for the tip!

Collapse
 
adevnoops profile image
DevNoops stack with us ticker: NOOPS

Arf, try object storage for files. Pretty easy to use and reliable. Versioning and confirmation to delete will save believe me.

Collapse
 
datmt profile image
Mạnh Đạt

Still better than rm -rf.
Cheer up and hae a backup plan nex time

Collapse
 
tehaisperlis profile image
Hazmi Irfan

Thanks yeah. Since it was just day 1 I never setup the backup.

Collapse
 
maxoralbay profile image
Max Oralbay

🙄🤔😒😀😄😀😀