Agile Web Development

Build it. Launch it. Love it.

Sexy Migrations

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

Vitals

Home http://errtheblog.com/post/2381
Repository svn://errtheblog.com/svn/plugins/sexy_migrations
License Rails' (MIT)
Tags Tag_red err migrations
Rating (11 votes)
Owner Chris Wanstrath
Created 29 March 2007

Comments

  • Avatar
    Hari Deepak
    18 May 2009

    I am not able to access svn://errtheblog.com/svn/plugins/sexy_migrations. Is the link down? is there any other place on the web where i can access the sexy_migrations folder?

Add a comment