patientslikeme / migration_helpers
- Source
- Commits
- Network (0)
- Issues (2)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Wed Sep 17 14:39:35 -0700 2008 | |
| |
README | Sun Jan 11 00:05:00 -0800 2009 | |
| |
Rakefile | Wed Sep 17 14:39:35 -0700 2008 | |
| |
init.rb | Wed Sep 17 14:59:13 -0700 2008 | |
| |
install.rb | Wed Sep 17 14:39:35 -0700 2008 | |
| |
lib/ | Thu Sep 18 09:19:07 -0700 2008 | |
| |
tasks/ | Wed Sep 17 14:39:35 -0700 2008 | |
| |
test/ | Wed Sep 17 14:39:35 -0700 2008 | |
| |
uninstall.rb | Wed Sep 17 14:39:35 -0700 2008 |
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
