Fix change_column_comment
to preserve column's AUTO_INCREMENT in the MySQL adapter
This commit is contained in:
parent
258e9adc05
commit
51852d2eb5
@ -9,6 +9,10 @@
|
||||
|
||||
*Nick Holden*
|
||||
|
||||
* Fix `change_column_comment` to preserve column's AUTO_INCREMENT in the MySQL adapter
|
||||
|
||||
*fatkodima*
|
||||
|
||||
* Fix quoting of `ActiveSupport::Duration` and `Rational` numbers in the MySQL adapter.
|
||||
|
||||
*Kevin McPhillips*
|
||||
|
@ -722,6 +722,8 @@ def change_column_for_alter(table_name, column_name, type, **options)
|
||||
options[:comment] = column.comment
|
||||
end
|
||||
|
||||
options[:auto_increment] = column.auto_increment?
|
||||
|
||||
td = create_table_definition(table_name)
|
||||
cd = td.new_column_definition(column.name, type, **options)
|
||||
schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
|
||||
|
@ -178,9 +178,13 @@ def test_change_table_comment_to_nil
|
||||
end
|
||||
|
||||
def test_change_column_comment
|
||||
@connection.change_column_comment :commenteds, :name, "Edited column comment"
|
||||
column = Commented.columns_hash["name"]
|
||||
@connection.change_column_comment :commenteds, :id, "Edited column comment"
|
||||
column = Commented.columns_hash["id"]
|
||||
assert_equal "Edited column comment", column.comment
|
||||
|
||||
if current_adapter?(:Mysql2Adapter)
|
||||
assert column.auto_increment?
|
||||
end
|
||||
end
|
||||
|
||||
def test_change_column_comment_to_nil
|
||||
|
Loading…
Reference in New Issue
Block a user