Does using migrations with Rails/Mongoid/MongoDB make sense? -


should create ar migrations i'm changing models? using mongoid , mongodb not see benefits. benefit can think of renaming field - can small script. work? gut telling me not need migrations, i'd hear more experience.

what best practice? should use migrations mongodb?

since mongodb not (as @ 2.6) provide server-side schema enforcement, data migration scripts not strictly required. can particularly helpful speed of development.

however, may still make sense create migrations production data if want practice "data hygiene" , ensure consistency across different deployments.

for example:

  • removing unused fields
  • adding new required fields
  • setting default values
  • renaming fields
  • loading required data/fixtures
  • ensuring required indexes

you have choice of doing of above one-off scripts or handling exception cases in application code. example, can lazily add missing fields or defaults documents loaded database editing.

for mongoid in particular may want try mongoid_rails_migrations gem.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -