diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2012-04-07 22:11:47 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2012-04-07 22:11:47 +0530 |
commit | bcd22696585b6be6f088780b37195ad0b1ff0fde (patch) | |
tree | b1a5c92ed3da59da326fc2bb545c1ade8e59ce19 /guides/source/migrations.textile | |
parent | 91b0ffc4fadb69590cc7197fc6497d146f469ce7 (diff) | |
parent | ef493c9259d62a761257de7ffd04258811a9f233 (diff) | |
download | rails-bcd22696585b6be6f088780b37195ad0b1ff0fde.tar.gz rails-bcd22696585b6be6f088780b37195ad0b1ff0fde.tar.bz2 rails-bcd22696585b6be6f088780b37195ad0b1ff0fde.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'guides/source/migrations.textile')
-rw-r--r-- | guides/source/migrations.textile | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/guides/source/migrations.textile b/guides/source/migrations.textile index 28426de6d7..f663496854 100644 --- a/guides/source/migrations.textile +++ b/guides/source/migrations.textile @@ -51,7 +51,7 @@ end This migration adds a table called +products+ with a string column called +name+ and a text column called +description+. A primary key column called +id+ will -also be added, however since this is the default we do not need to ask for this. +also be added, however since this is the default we do not need to explicitly specify it. The timestamp columns +created_at+ and +updated_at+ which Active Record populates automatically will also be added. Reversing this migration is as simple as dropping the table. @@ -65,7 +65,7 @@ class AddReceiveNewsletterToUsers < ActiveRecord::Migration change_table :users do |t| t.boolean :receive_newsletter, :default => false end - User.update_all ["receive_newsletter = ?", true] + User.update_all :receive_newsletter => true end def down @@ -635,10 +635,9 @@ example, $ rake db:migrate:up VERSION=20080906120000 </shell> -will run the +up+ method from the 20080906120000 migration. These tasks still -check whether the migration has already run, so for example +db:migrate:up -VERSION=20080906120000+ will do nothing if Active Record believes that -20080906120000 has already been run. +will run the +up+ method from the 20080906120000 migration. This task will first +check whether the migration is already performed and will do nothing if Active Record believes +that it has already been run. h4. Changing the output of running migrations |