Plugins - Sexy Migrations

StarAdd to favorites

Let’s turn this:

  class UpdateYourFamily < ActiveRecord::Migration
    create_table :updates do |t|
      t.column :user_id,  :integer
      t.column :group_id, :integer
      t.column :body,     :text
      t.column :type,     :string

      t.column :created_at, :datetime
      t.column :updated_at, :datetime
    end

    def self.down
      drop_table :updates
    end
  end

  Into this:

  class UpdateYourFamily < ActiveRecord::Migration
    create_table :updates do
      foreign_key :user
      foreign_key :group

      text   :body
      string :type

      timestamps!
    end

    def self.down
      drop_table :updates
    end
  end

Using this:

SVN:

$ ./script/plugin install svn://errtheblog.com/svn/plugins/sexy_migrations

Piston:

$ piston import svn://errtheblog.com/svn/plugins/sexy_migrations vendor/plugins/sexy_migrations

Chris Wanstrath

http://errtheblog.com/post/2381

svn://errtheblog.com/svn/plugins/sexy_migrations

Rails' (MIT)

  • Currently 4.6/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Model

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?