diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-03-26 12:27:52 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-03-26 12:27:52 +0000 |
commit | ca9413674ea70dc67ab517734af2e40dac21beef (patch) | |
tree | 86cbf305a2b1b4688a5b6f7cfbce8a9aa505c5f7 /activerecord/lib/active_record/migration.rb | |
parent | 5c47ceb30b940a8cd8eb681a898895bce46f79dd (diff) | |
download | rails-ca9413674ea70dc67ab517734af2e40dac21beef.tar.gz rails-ca9413674ea70dc67ab517734af2e40dac21beef.tar.bz2 rails-ca9413674ea70dc67ab517734af2e40dac21beef.zip |
Improve documentation.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/migration.rb')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 21 |
1 files changed, 19 insertions, 2 deletions
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 <tt>script/generate migration MyNewMigration</tt> + # 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 <tt>nnn_my_new_migration.rb</tt> in the <tt>db/migrate/</tt> + # create an empty migration file <tt>nnn_my_new_migration.rb</tt> in the <tt>db/migrate/</tt> # directory where <tt>nnn</tt> is the next largest migration number. + # # You may then edit the <tt>self.up</tt> and <tt>self.down</tt> 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 <tt>nnn_add_fieldname_to_tablename</tt>, 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 # <tt>rake db:migrate</tt>. This will update the database by running all of the # pending migrations, creating the <tt>schema_info</tt> table if missing. |