patientslikeme / migration_helpers

Rails plugin that adds some convenient helpers for your migrations.

This URL has Read+Write access

name age message
file MIT-LICENSE Wed Sep 17 14:39:35 -0700 2008 first commit [patientslikeme]
file README Sun Jan 11 00:05:00 -0800 2009 added install command and examples to readme [patientslikeme]
file Rakefile Wed Sep 17 14:39:35 -0700 2008 first commit [patientslikeme]
file init.rb Wed Sep 17 14:59:13 -0700 2008 [patientslikeme]
file install.rb Wed Sep 17 14:39:35 -0700 2008 first commit [patientslikeme]
directory lib/ Thu Sep 18 09:19:07 -0700 2008 Call #each, not #each_pair. Rails OrderedHash d... [patientslikeme]
directory tasks/ Wed Sep 17 14:39:35 -0700 2008 first commit [patientslikeme]
directory test/ Wed Sep 17 14:39:35 -0700 2008 first commit [patientslikeme]
file uninstall.rb Wed Sep 17 14:39:35 -0700 2008 first commit [patientslikeme]
README
Helpers for your Rails migrations.

script/plugin install git://github.com/patientslikeme/migration_helpers.git  


Example
=======

  # insert a row using a Ruby hash
  insert_row 'books', :name => 'Fellowship of the Ring', :author => 'Tolkien', :price => 9.99
  
  # update one or more rows
  update_row 'books', :set => { :price => 4.99 }, :where => { :name => 'Fellowship of the Ring' }
  update_row 'books', :set => 'price=price/2', :where => 'author is not null' 
  update_row 'books', :set => { :price => 4.99 }, :update_all => true

  # delete rows using a Ruby hash
  delete_row 'books', :author => 'Tolkien'
  delete_row 'books', :delete_all => true

  # add a foreign key constraint
  add_foreign_key 'books', 'author_id', 'authors'


Copyright (c) 2008 PatientsLikeMe, Inc., released under the MIT license