Project

mongration

0.01
No commit activity in last 3 years
No release in over 3 years
Mongration is a tool for migrating data. It is designed to have the same interface as ActiveRecord's migrations but be used with Mongoid instead of an SQL database.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
= 0.7.0
= 3.0
= 1.4.1
= 0.7.1

Runtime

~> 5.0
>= 0
 Project Readme

Mongration Build Status Code Climate Coverage Status

ActiveRecord-like Migrations for Mongoid

Mongration is a tool for migrating data. It is designed to have the same interface as ActiveRecord's migrations but be used with Mongoid instead of an SQL database.

Mongration supports the following rake tasks:

  • db:migrate - migrates all pending migrations
  • db:migrate VERSION=123 - moves to the specified version. If the version is greater than the current version, it will move up. If the version is lesser than the current version, it will move down.
  • db:rollback - rolls back the most recent migration
  • db:rollback STEP=N - rolls back the N most recent migrations
  • db:version - outputs the numeric identifier for the most recent migration
  • db:migrate:create - takes the place of the rails generate migration generator
  • db:migrate:status - outputs a table of all files and their migration status

Support

The following versions of Ruby are supported:

  • MRI 2.1
  • MRI 2.0
  • MRI 1.9.3
  • JRuby 1.9

Installation

Add this line to your application's Gemfile:

gem 'mongration'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mongration --pre

Usage

The primary usage will be through the Rake tasks db:migrate and db:rollback. Migrate will run all migrations that have not been run before. Rollback will rollback the previous migration.

Migration files have the following structure:

class AddFoo
  def self.up
  end

  def self.down
  end
end

The above file could be created with bundle exec rake db:migrate:create[AddFoo] or bundle exec rake db:migrate:create[add_foo].

Contributing

Contributions are welcome. Please make sure you write a test for any new features or bugs.

  1. Fork it ( https://github.com/[my-github-username]/mongration/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request