Migration - Did I just lose all of my data?

80 views Asked by At

Being newer to Ruby on Rails and while I have a fair understanding of certain areas, I am still learning. The one area I have difficulty is migrations/databases and I fear I may have had a terrible mistake.

I am currently working on building a blog and recently added a comments section. My next project was to have friendly URLs (using the friendly_id gem) and when I needed to create a new column for slugs, it seemed to already exist (from trying at a previous time I suppose).

Anyway, I tried to reset to an older commit but I know now (unless I am mistaken) that it has no affect on migrations? After some research I tried to rollback my database to undo whatever happened with the slugs. Ultimately, I went too far back that the only database I had was for my blog posts (and nothing for the users and comments).

I have since done a rake db:migrate and everything has been generated again but the content (via the localhost) was removed. I don't mind that because the content I have on my localhost does not have everything my live site does (http://www.joedayvie.com), granted its not much there either.

Anyway, I am really lost at this point and concerned. If I git push heroku master in the console will my content be removed or will this happen when I update the migrations onto heroku? Is there anything I can do to revert prior to this whole mess happening?

I apologize for seeming quite confused (but I am 100% self taught and lost). I greatly appreciate any information anyone may be able to provide me.

Thank you so much for reading!

Joe

PS: Of course if it's possible that this may not affect my website at all, please let me know. I just want to know more information before going further - Thank you! =)

1

There are 1 answers

1
GreenAsJade On

You need to read about backups on Heroku

Then - you need to create a backup of your production system on heroku and prove to yourself that you can load it, by doing so on your local system.

When you have your local system looking like your production system again, you will know that you know how to recover even if the mess does happen again.