提交 5870bc86 编写于 作者: R Rafael França

Merge pull request #24362 from kamipo/add_test_create_record_with_pk_as_zero

Add a test case for create a record with primary key as zero
......@@ -856,6 +856,7 @@ def configure_connection
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 @@ def test_update_prepared_statement
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 }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册