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.

Oldest comments (31)

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
 
coderslang profile image
Coderslang: Become a Software Engineer

You live and you learn...

Collapse
 
tehaisperlis profile image
Hazmi Irfan

True!

Collapse
 
maxoralbay profile image
Max Oralbay

🙄🤔😒😀😄😀😀

Collapse
 
koffisani profile image
Koffi Sani

Not easy. It's sometimes not recommended to use CTRL+R to find a previously used command, as you may choose the wrong command.

Collapse
 
tehaisperlis profile image
Hazmi Irfan

I know I did!

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
 
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
 
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
 
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
 
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.