0

I was having issues deploying my Heroku Rails app - and came across another SO post that suggested using:

heroku run rake db:reset

Which I ran without thinking, and of course my database was dropped and setup... and I no longer have any data on my heroku app.

Is there an easy way to get my database info back? I tried running

heroku run rake db:rollback

but haven't had any luck yet.

Anyone know of any easy solution to this? I kind of need this data, and most definitely cannot lose it! Thanks for any help you can offer!

Community
  • 1
  • 1
Terence Devine
  • 115
  • 1
  • 13
  • I'd strongly recommend asking heroku support for this help - they'll be able to give you the best advice. – Taryn East Dec 16 '15 at 22:27
  • You will find no solution in Rails, the data has been deleted. You must check for an Heroku backup. – Baldrick Dec 16 '15 at 22:28
  • Check out the [Heroku PG Backups documentation](https://devcenter.heroku.com/articles/heroku-postgres-backups#checking-backup-status) to see if a backup was made recently. It's your best bet. – fivedigit Dec 16 '15 at 22:29
  • Do you have same data locally on your machine? – uday Dec 16 '15 at 22:48
  • No - this was all data that was added only on the heroku app... I've opened a ticket with Heroku, waiting to hear back now. I also have no backup, might be SOL. – Terence Devine Dec 16 '15 at 22:55

1 Answers1

1
rake db:reset

Can not be undone unless you have a database backup. If you found a database backup use the following to restore your database.

psql dbname < infile

Tips:
1. rake db:rollback does not get your database back. Instead, it rollbacks the last migration in your schema_migrations table.
2. Always create database backups for your production applications.
3. Read this answer it may come in handy.

Community
  • 1
  • 1
Oss
  • 4,232
  • 2
  • 20
  • 35