diff options
author | Sandip Ransing <sandip@joshsoftware.com> | 2012-04-06 00:44:56 +0530 |
---|---|---|
committer | Sandip Ransing <sandip@joshsoftware.com> | 2012-04-06 00:44:56 +0530 |
commit | e59b66979236c93b42467f5656da28179db1397c (patch) | |
tree | 38ca3c22e24a7de03bc5e1355f809b25c80d373e /guides | |
parent | 163258ba2a7ff325cb79d70a1ad15aeb3d270e28 (diff) | |
download | rails-e59b66979236c93b42467f5656da28179db1397c.tar.gz rails-e59b66979236c93b42467f5656da28179db1397c.tar.bz2 rails-e59b66979236c93b42467f5656da28179db1397c.zip |
Improvement to migration guide
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/migrations.textile | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/guides/source/migrations.textile b/guides/source/migrations.textile index 28426de6d7..1d8c1e03f3 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 write for this. 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,10 @@ 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, so for example + +db:migrate:up VERSION=20080906120000+ will do nothing if Active Record believes + that 20080906120000 has already been run. h4. Changing the output of running migrations |