aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorEric Tipton <eric.tipton@gmail.com>2013-08-10 03:25:04 -0400
committerEric Tipton <eric.tipton@gmail.com>2013-08-10 03:25:04 -0400
commit3a21870c6ff33e8e4add102b3757af60367a17d7 (patch)
tree79e2ad1a7f12e799069baf73fd093e49b9b0070d /activerecord/lib
parent4f5f59a492bd32afa476ac6b51ca5295b70fe246 (diff)
downloadrails-3a21870c6ff33e8e4add102b3757af60367a17d7.tar.gz
rails-3a21870c6ff33e8e4add102b3757af60367a17d7.tar.bz2
rails-3a21870c6ff33e8e4add102b3757af60367a17d7.zip
Make 'enable_extension' revertible
If 'enable_extension' is used in a migration's 'change' method, use 'disable_extension' on down migration (and vice-versa).
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/migration/command_recorder.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb
index 9782a48055..01c73be849 100644
--- a/activerecord/lib/active_record/migration/command_recorder.rb
+++ b/activerecord/lib/active_record/migration/command_recorder.rb
@@ -73,7 +73,7 @@ module ActiveRecord
[: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_default, :add_reference, :remove_reference, :transaction,
- :drop_join_table, :drop_table, :execute_block,
+ :drop_join_table, :drop_table, :execute_block, :enable_extension,
:change_column, :execute, :remove_columns, # irreversible methods need to be here too
].each do |method|
class_eval <<-EOV, __FILE__, __LINE__ + 1
@@ -100,6 +100,7 @@ module ActiveRecord
add_column: :remove_column,
add_timestamps: :remove_timestamps,
add_reference: :remove_reference,
+ enable_extension: :disable_extension
}.each do |cmd, inv|
[[inv, cmd], [cmd, inv]].uniq.each do |method, inverse|
class_eval <<-EOV, __FILE__, __LINE__ + 1