diff options
author | Yoshiyuki Kinjo <yskkin@gmail.com> | 2019-04-14 20:31:05 +0900 |
---|---|---|
committer | Yoshiyuki Kinjo <yskkin@gmail.com> | 2019-04-15 08:43:22 +0900 |
commit | 1fe71ebd0486299de36d4ed551d38043ce8a419b (patch) | |
tree | e66671f96118a323e0efc0111fef263821f3dfdc /activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | |
parent | 3e66ba91d511158e22f90ff96b594d61f40eda01 (diff) | |
download | rails-1fe71ebd0486299de36d4ed551d38043ce8a419b.tar.gz rails-1fe71ebd0486299de36d4ed551d38043ce8a419b.tar.bz2 rails-1fe71ebd0486299de36d4ed551d38043ce8a419b.zip |
make change_column_comment and change_table_comment invertible
We can revert migrations using `change_column_comment` or
`change_table_comment` at current master.
However, results are not what we expect: comments are remained in new
status.
This change tells previous comment to these methods in a way like
`change_column_default`.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 2a2b234ef8..8b907759c6 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -285,7 +285,8 @@ module ActiveRecord SQL end - def change_table_comment(table_name, comment) #:nodoc: + def change_table_comment(table_name, comment_or_changes) # :nodoc: + comment = extract_new_comment_value(comment_or_changes) comment = "" if comment.nil? execute("ALTER TABLE #{quote_table_name(table_name)} COMMENT #{quote(comment)}") end @@ -341,7 +342,8 @@ module ActiveRecord change_column table_name, column_name, nil, null: null end - def change_column_comment(table_name, column_name, comment) #:nodoc: + def change_column_comment(table_name, column_name, comment_or_changes) # :nodoc: + comment = extract_new_comment_value(comment_or_changes) change_column table_name, column_name, nil, comment: comment end |