Ask A Question


You’re not receiving notifications from this thread.

Backing up Heroku PG and than pushing my brand new rails 5 app.

Masud Hossain asked in Servers

If you back up your Heroku PG database, this is storing all your users login info, right?

So can I delete my whole rails app, push up a brand new rails app (using devise and rails5) and than put in the backup PG i made on heroku?

Will this let my users sign in with their original email/pw?


As long as your new app uses the same stuff as before, yes.

The passwords are hashed and salted and stored on the User record. Then moving the database to a new app doesn't matter because to check a user's password you go through the same hash and salt process to verify it. Nothing in your app is unique to that process, just the user's password. As long as your old app used Devise and your new one uses Devise too, then migrating the database to a new instance should work just fine.

For example, you could transfer the production database to your laptop and running the code on your laptop, you should be able to login to your production account just fine as long as you use the same authentication method in both places.

If you move between Devise and something else, then you'll have to make sure the authentication methods operate the same way. That's doable, but it's harder as you'd have to write code to make Devise use the same algorithm for hashing passwords as the old system.

Of course, I would caution you not to delete the old app until you can guarantee your new site is up and running with the database.


Thanks a whole bunch for clearing it up, Chris!

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.