mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #16592 from aditya-kapoor/fix-migration-docs
[ci skip] correct docs about the migration generation
This commit is contained in:
commit
2b7d67d49d
1 changed files with 2 additions and 9 deletions
|
@ -161,21 +161,14 @@ module ActiveRecord
|
||||||
# in the <tt>db/migrate/</tt> directory where <tt>timestamp</tt> is the
|
# in the <tt>db/migrate/</tt> directory where <tt>timestamp</tt> is the
|
||||||
# UTC formatted date and time that the migration was generated.
|
# UTC formatted date and time that the migration was generated.
|
||||||
#
|
#
|
||||||
# You may then edit the <tt>up</tt> and <tt>down</tt> methods of
|
|
||||||
# MyNewMigration.
|
|
||||||
#
|
|
||||||
# There is a special syntactic shortcut to generate migrations that add fields to a table.
|
# There is a special syntactic shortcut to generate migrations that add fields to a table.
|
||||||
#
|
#
|
||||||
# rails generate migration add_fieldname_to_tablename fieldname:string
|
# rails generate migration add_fieldname_to_tablename fieldname:string
|
||||||
#
|
#
|
||||||
# This will generate the file <tt>timestamp_add_fieldname_to_tablename</tt>, which will look like this:
|
# This will generate the file <tt>timestamp_add_fieldname_to_tablename</tt>, which will look like this:
|
||||||
# class AddFieldnameToTablename < ActiveRecord::Migration
|
# class AddFieldnameToTablename < ActiveRecord::Migration
|
||||||
# def up
|
# def change
|
||||||
# add_column :tablenames, :fieldname, :string
|
# add_column :tablenames, :field, :string
|
||||||
# end
|
|
||||||
#
|
|
||||||
# def down
|
|
||||||
# remove_column :tablenames, :fieldname
|
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue