Rails Icon

Mongrations - migrations for MongoMapper

logged by @logbot 2010-02-27T15:19:43Z permalink #rails

Why would a schema-less database need migrations? Simple: to help you keep old data fresh as you change your data format. Recently added new columns to your MongoMapper model and need to update old values in your MongoDB collection? Terry Heath gives you Mongrations:

script/generate mongration update_followers_count_for_existing

You’ll get a new file with the familiar Rails migration format:

class UpdateFollowersCountForExisting < MongoMapper::Mongration
  def self.up

  def self.down

Just add your own code to manipulate your data and call rake db:mongrate. Mongrations include rake tasks for db:mongrate:redo, db:mongrate:up, db:mongrate:down, db:mongrate:rollback.

[Source on GitHub] [Blog post]

0:00 / 0:00