1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Update what methods Migration#change can reverse

* Documentations and comments about what methods
  `Migration#change` can reverse is out of date.
  For example `change_column_default` is now reversible
  by this [commit](https://github.com/rails/rails/pull/20018).

* Comments about `CommandRecorder` dose not match with Rails Guide.
  For example `add_foreign_key` is listed only on Rails Guide.
This commit is contained in:
yui-knk 2015-08-30 20:28:55 +09:00
parent 79f44eb6c8
commit df9cfc055a
2 changed files with 34 additions and 15 deletions

View file

@ -5,10 +5,22 @@ module ActiveRecord
# knows how to invert the following commands:
#
# * add_column
# * add_foreign_key
# * add_index
# * add_reference
# * add_timestamps
# * create_table
# * change_column_default (must supply a :from and :to option)
# * change_column_null
# * create_join_table
# * create_table
# * disable_extension
# * drop_join_table
# * drop_table (must supply a block)
# * enable_extension
# * remove_column (must supply a type)
# * remove_foreign_key (must supply a second table)
# * remove_index
# * remove_reference
# * remove_timestamps
# * rename_column
# * rename_index

View file

@ -522,20 +522,27 @@ majority of cases, where Active Record knows how to reverse the migration
automatically. Currently, the `change` method supports only these migration
definitions:
* `add_column`
* `add_index`
* `add_reference`
* `add_timestamps`
* `add_foreign_key`
* `create_table`
* `create_join_table`
* `drop_table` (must supply a block)
* `drop_join_table` (must supply a block)
* `remove_timestamps`
* `rename_column`
* `rename_index`
* `remove_reference`
* `rename_table`
* add_column
* add_foreign_key
* add_index
* add_reference
* add_timestamps
* change_column_default (must supply a :from and :to option)
* change_column_null
* create_join_table
* create_table
* disable_extension
* drop_join_table
* drop_table (must supply a block)
* enable_extension
* remove_column (must supply a type)
* remove_foreign_key (must supply a second table)
* remove_index
* remove_reference
* remove_timestamps
* rename_column
* rename_index
* rename_table
`change_table` is also reversible, as long as the block does not call `change`,
`change_default` or `remove`.