ActiveRecord automigrations

Create/modify/delete Active Record columns without migrations. It works with PostgreSQL and SQLite.

Installation

gem 'automigration'

Usage

Add has_fields into your models:

class User < ActiveRecord::Base
  has_fields do
    string :name
    integer :login_count
  end
end

Fire in console:

rake db:migrate

To keep some system tables add to config/application.rb

  config.automigration.system_tables += %w[hits very_system_table]

Supported fields:

  • belongs_to
  • boolean
  • date
  • datetime
  • float
  • integer
  • string
  • text
  • time

Timestamps

By default in models with has_fields always columns updated_at and created_at created. To ignore use has_fields(:timestamps => false)

Status