mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #44535 from rnkaufman/respect-auto-increment-setting
Respect auto increment setting in abstract mysql adapter
This commit is contained in:
commit
53f703b3e8
2 changed files with 18 additions and 1 deletions
|
@ -722,7 +722,9 @@ module ActiveRecord
|
|||
options[:comment] = column.comment
|
||||
end
|
||||
|
||||
options[:auto_increment] = column.auto_increment?
|
||||
unless options.key?(:auto_increment)
|
||||
options[:auto_increment] = column.auto_increment?
|
||||
end
|
||||
|
||||
td = create_table_definition(table_name)
|
||||
cd = td.new_column_definition(column.name, type, **options)
|
||||
|
|
|
@ -1347,6 +1347,21 @@ if ActiveRecord::Base.connection.supports_bulk_alter?
|
|||
assert_equal "This is a comment", column(:birthdate).comment
|
||||
end
|
||||
|
||||
if current_adapter?(:Mysql2Adapter)
|
||||
def test_updating_auto_increment
|
||||
with_bulk_change_table do |t|
|
||||
t.change :id, :bigint, auto_increment: true
|
||||
end
|
||||
|
||||
assert column(:id).auto_increment?
|
||||
|
||||
with_bulk_change_table do |t|
|
||||
t.change :id, :bigint, auto_increment: false
|
||||
end
|
||||
assert_not column(:id).auto_increment?
|
||||
end
|
||||
end
|
||||
|
||||
def test_changing_index
|
||||
with_bulk_change_table do |t|
|
||||
t.string :username
|
||||
|
|
Loading…
Reference in a new issue