Last active
August 29, 2015 14:07
-
-
Save swards/a9dc956c416c327372c1 to your computer and use it in GitHub Desktop.
Migrate from Mongo to Postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tested on: Rails 3.2, Mongoid 2.0.1, pg 0.12.0 gem | |
Using Clearance (not devise) | |
1. remove mongoid gem(s) | |
2. add pg gem | |
3. in application.rb re-add ActiveRecord | |
4. for all models | |
- inherit from < ActiveRecord::Base | |
- get rid of Mongoid references everywhere | |
- change embeds_many, embeds_one - look out for polymorphic | |
- get rid of 'store_in, indexes, desc/asc/nin/ne/order_by/in methods, field, embed_many, embed_one, of_type' | |
- create migration and move relations and fields | |
- add paperclip migrations | |
5. Run Migrations | |
6. Modify any mongoid-specific query, etc. code | |
- you'll likely need to update migrations and rerun | |
7. Get all rspec tests going | |
8. Get all cucumber tests going |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment