aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2012-12-18 23:32:45 -0500
committerMarc-Andre Lafortune <github@marc-andre.ca>2012-12-21 13:54:52 -0500
commite43e8e268f0522f9f11f4eacae1d04afca768c9b (patch)
treec512c465509c02d4007c04123ed0f985fefb20b9 /activerecord/lib/active_record/migration
parentaedcd683684d08eaf30623a4b48ce31a31426372 (diff)
downloadrails-e43e8e268f0522f9f11f4eacae1d04afca768c9b.tar.gz
rails-e43e8e268f0522f9f11f4eacae1d04afca768c9b.tar.bz2
rails-e43e8e268f0522f9f11f4eacae1d04afca768c9b.zip
Make change_table reversible when possible [#8267]
Diffstat (limited to 'activerecord/lib/active_record/migration')
-rw-r--r--activerecord/lib/active_record/migration/command_recorder.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb
index 4ea709fe69..f738c909bc 100644
--- a/activerecord/lib/active_record/migration/command_recorder.rb
+++ b/activerecord/lib/active_record/migration/command_recorder.rb
@@ -70,7 +70,7 @@ module ActiveRecord
super || delegate.respond_to?(*args)
end
- [:create_table, :create_join_table, :change_table, :rename_table, :add_column, :remove_column,
+ [:create_table, :create_join_table, :rename_table, :add_column, :remove_column,
:rename_index, :rename_column, :add_index, :remove_index, :add_timestamps, :remove_timestamps,
:change_column, :change_column_default, :add_reference, :remove_reference, :transaction,
:drop_join_table, :drop_table, :remove_columns, :remove_index,
@@ -84,6 +84,10 @@ module ActiveRecord
alias :add_belongs_to :add_reference
alias :remove_belongs_to :remove_reference
+ def change_table(table_name, options = {})
+ yield ConnectionAdapters::Table.new(table_name, self)
+ end
+
private
module StraightReversions