Treat blank comments as no comment for indexes
Follow up of 1683410. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
This commit is contained in:
parent
7fc4979d4d
commit
2db8514d21
@ -217,7 +217,7 @@ def indexes(table_name, name = nil)
|
||||
]
|
||||
end
|
||||
|
||||
IndexDefinition.new(table_name, index_name, unique, columns, [], orders, where, nil, using.to_sym, comment)
|
||||
IndexDefinition.new(table_name, index_name, unique, columns, [], orders, where, nil, using.to_sym, comment.presence)
|
||||
end.compact
|
||||
end
|
||||
|
||||
|
@ -168,10 +168,6 @@ def supports_comments?
|
||||
true
|
||||
end
|
||||
|
||||
def supports_comments_in_create?
|
||||
false
|
||||
end
|
||||
|
||||
def supports_savepoints?
|
||||
true
|
||||
end
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
class CommentTest < ActiveRecord::TestCase
|
||||
include SchemaDumpingHelper
|
||||
self.use_transactional_tests = false if current_adapter?(:Mysql2Adapter)
|
||||
|
||||
class Commented < ActiveRecord::Base
|
||||
self.table_name = 'commenteds'
|
||||
@ -29,6 +28,10 @@ class BlankComment < ActiveRecord::Base
|
||||
t.string :empty_comment, comment: ''
|
||||
t.string :nil_comment, comment: nil
|
||||
t.string :absent_comment
|
||||
t.index :space_comment, comment: ' '
|
||||
t.index :empty_comment, comment: ''
|
||||
t.index :nil_comment, comment: nil
|
||||
t.index :absent_comment
|
||||
end
|
||||
|
||||
Commented.reset_column_information
|
||||
@ -54,6 +57,12 @@ def test_blank_columns_created_in_block
|
||||
end
|
||||
end
|
||||
|
||||
def test_blank_indexes_created_in_block
|
||||
@connection.indexes('blank_comments').each do |index|
|
||||
assert_nil index.comment
|
||||
end
|
||||
end
|
||||
|
||||
def test_add_column_with_comment_later
|
||||
@connection.add_column :commenteds, :rating, :integer, comment: 'I am running out of imagination'
|
||||
Commented.reset_column_information
|
||||
|
Loading…
Reference in New Issue
Block a user