diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-09-22 23:04:54 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-09-22 23:04:54 +0900 |
commit | 6fd81d2d8ee77053c10a998c77d3799dfd3c51c0 (patch) | |
tree | 38563ccd840e8512ec22e5ab7d61ec00b086527b /activerecord | |
parent | a0277a974ce881d975b13634bcc7da17bc906844 (diff) | |
download | rails-6fd81d2d8ee77053c10a998c77d3799dfd3c51c0.tar.gz rails-6fd81d2d8ee77053c10a998c77d3799dfd3c51c0.tar.bz2 rails-6fd81d2d8ee77053c10a998c77d3799dfd3c51c0.zip |
Return nil if table comment is blank
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/comment_test.rb | 2 |
2 files changed, 2 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 3dad43ced8..6e35bb0bbe 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -284,7 +284,7 @@ module ActiveRecord def table_comment(table_name) # :nodoc: scope = quoted_scope(table_name) - query_value(<<-SQL.strip_heredoc, "SCHEMA") + query_value(<<-SQL.strip_heredoc, "SCHEMA").presence SELECT table_comment FROM information_schema.tables WHERE table_schema = #{scope[:schema]} diff --git a/activerecord/test/cases/comment_test.rb b/activerecord/test/cases/comment_test.rb index 40eb3e08c1..584e03d196 100644 --- a/activerecord/test/cases/comment_test.rb +++ b/activerecord/test/cases/comment_test.rb @@ -150,7 +150,7 @@ if ActiveRecord::Base.connection.supports_comments? def test_change_table_comment_to_nil @connection.change_table_comment :commenteds, nil - assert @connection.table_comment("commenteds").blank? + assert_nil @connection.table_comment("commenteds") end def test_change_column_comment |