Test microsecond on mysql 5.6

上级 df5a38fc
......@@ -212,7 +212,7 @@ def test_preserving_time_objects
)
# For adapters which support microsecond resolution.
if current_adapter?(:PostgreSQLAdapter, :SQLite3Adapter)
if current_adapter?(:PostgreSQLAdapter, :SQLite3Adapter) || mysql_56?
assert_equal 11, Topic.find(1).written_on.sec
assert_equal 223300, Topic.find(1).written_on.usec
assert_equal 9900, Topic.find(2).written_on.usec
......
......@@ -41,6 +41,11 @@ def in_memory_db?
ActiveRecord::Base.connection_pool.spec.config[:database] == ":memory:"
end
def mysql_56?
current_adapter?(:Mysql2Adapter) &&
ActiveRecord::Base.connection.send(:version).join(".") >= "5.6.0"
end
def supports_savepoints?
ActiveRecord::Base.connection.supports_savepoints?
end
......
......@@ -674,7 +674,11 @@ def create_table(*args, &block)
t.string :title
t.string :author_name
t.string :author_email_address
t.datetime :written_on
if mysql_56?
t.datetime :written_on, limit: 6
else
t.datetime :written_on
end
t.time :bonus_time
t.date :last_read
# use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册