From ca9413674ea70dc67ab517734af2e40dac21beef Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 26 Mar 2008 12:27:52 +0000 Subject: Improve documentation. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/migration.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/migration.rb') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 635eab8428..9945f9cd75 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -91,13 +91,30 @@ module ActiveRecord # # The Rails package has several tools to help create and apply migrations. # - # To generate a new migration, use script/generate migration MyNewMigration + # To generate a new migration, you can use + # script/generate migration MyNewMigration + # # where MyNewMigration is the name of your migration. The generator will - # create a file nnn_my_new_migration.rb in the db/migrate/ + # create an empty migration file nnn_my_new_migration.rb in the db/migrate/ # directory where nnn is the next largest migration number. + # # You may then edit the self.up and self.down methods of # MyNewMigration. # + # There is a special syntactic shortcut to generate migrations that add fields to a table. + # script/generate migration add_fieldname_to_tablename fieldname:string + # + # This will generate the file nnn_add_fieldname_to_tablename, which will look like this: + # class AddFieldnameToTablename < ActiveRecord::Migration + # def self.up + # add_column :tablenames, :fieldname, :string + # end + # + # def self.down + # remove_column :tablenames, :fieldname + # end + # end + # # To run migrations against the currently configured database, use # rake db:migrate. This will update the database by running all of the # pending migrations, creating the schema_info table if missing. -- cgit v1.2.3