I have an existing Rails app that I've put about 100 hours of development into. I would like to push it up to Heroku but I made the mistake of using mongoDB for all of my developmental work. Now I have no schemas or anything of the sort and I'm trying to push out to Heroku and use PostgreSQL. Is there a way I can remove Mongoid and use Postgres? I've tried using DataMapper, but that seems to be doing more harm than good.
-
8Why not use MongoDB on Heroku via MongoHQ or MongoLab?user24359– user243592012-08-28 04:13:02 +00:00Commented Aug 28, 2012 at 4:13
-
2Switching databases (even between relational databases) tends to involve a lot of rewriting, going from MongoDB to PostgreSQL will probably be a bit of a nightmare.mu is too short– mu is too short2012-08-28 04:16:04 +00:00Commented Aug 28, 2012 at 4:16
-
@IsaacCambron, that's a good idea. I think I will take that route.Pyro2927– Pyro29272012-08-28 13:52:34 +00:00Commented Aug 28, 2012 at 13:52
2 Answers
Whether the migration is easy or hard depends on a very large number of things including how many different versions of data structures you have to accommodate. In general you will find it a lot easier if you approach this in stages:
Ensure that all the Mongo data is consistent in structure with your RDBMS model and that the data structure versions are all the same.
Move your data. Expect that problems will be found and you will have to go back to step 1.
The primary problems you can expect are data validation problems because you are moving from a less structured data platform to a more structured one.
Depending on what you are doing regarding MapReduce you may have some work there as well.