mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add a test case for create a record with primary key as zero
This commit is contained in:
parent
cd736dbfa4
commit
6ccbc63849
2 changed files with 7 additions and 0 deletions
|
@ -856,6 +856,7 @@ module ActiveRecord
|
|||
sql_mode = "REPLACE(#{sql_mode}, 'STRICT_ALL_TABLES', '')"
|
||||
sql_mode = "REPLACE(#{sql_mode}, 'TRADITIONAL', '')"
|
||||
end
|
||||
sql_mode = "CONCAT(#{sql_mode}, ',NO_AUTO_VALUE_ON_ZERO')"
|
||||
end
|
||||
sql_mode_assignment = "@@SESSION.sql_mode = #{sql_mode}, " if sql_mode
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
|
||||
def test_create_record_with_pk_as_zero
|
||||
Book.create(id: 0)
|
||||
assert_equal 0, Book.find(0).id
|
||||
assert_nothing_raised { Book.destroy(0) }
|
||||
end
|
||||
|
||||
def test_tables
|
||||
tables = nil
|
||||
ActiveSupport::Deprecation.silence { tables = @connection.tables }
|
||||
|
|
Loading…
Reference in a new issue