提交 ceb68d18 编写于 作者: P Piotr Sarnacki

Revert "Merge pull request #6344"

This commit needs to be reverted because it introduces difficulties when
using sqlite3 in development and other databases in production. This
happens because when you create time column in sqlite3, it's dumped as
datetime in schema.rb file.

This reverts commit 57d534ee, reversing
changes made to 20f049fb.

Conflicts:

	activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
上级 e941eaa5
......@@ -191,7 +191,7 @@ def native_database_types #:nodoc:
:decimal => { :name => "decimal" },
:datetime => { :name => "datetime" },
:timestamp => { :name => "datetime" },
:time => { :name => "datetime" },
:time => { :name => "time" },
:date => { :name => "date" },
:binary => { :name => "blob" },
:boolean => { :name => "boolean" }
......
......@@ -24,7 +24,7 @@ def setup
@conn.extend(LogIntercepter)
@conn.intercepted = true
end
def teardown
@conn.intercepted = false
@conn.logged = []
......@@ -43,11 +43,6 @@ def test_column_types
assert(!result.rows.first.include?("blob"), "should not store blobs")
end
def test_time_column
owner = Owner.create!(:eats_at => Time.utc(1995,1,1,6,0))
assert_match(/1995-01-01/, owner.reload.eats_at.to_s)
end
def test_exec_insert
column = @conn.columns('items').find { |col| col.name == 'number' }
vals = [[column, 10]]
......
......@@ -504,7 +504,7 @@ def test_default_values
end
# Oracle, and Sybase do not have a TIME datatype.
unless current_adapter?(:OracleAdapter, :SybaseAdapter, :SQLite3Adapter)
unless current_adapter?(:OracleAdapter, :SybaseAdapter)
def test_utc_as_time_zone
Topic.default_timezone = :utc
attributes = { "bonus_time" => "5:42:00AM" }
......@@ -746,9 +746,6 @@ def test_multiparameter_attributes_on_time_with_raise_on_small_time_if_missing_d
end
def test_multiparameter_attributes_on_time_will_ignore_hour_if_missing
ActiveRecord::Base.time_zone_aware_attributes = false
ActiveRecord::Base.default_timezone = :local
Time.zone = nil
attributes = {
"written_on(1i)" => "2004", "written_on(2i)" => "12", "written_on(3i)" => "12",
"written_on(5i)" => "12", "written_on(6i)" => "02"
......@@ -855,7 +852,7 @@ def test_multiparameter_attributes_on_time_with_skip_time_zone_conversion_for_at
end
# Oracle, and Sybase do not have a TIME datatype.
unless current_adapter?(:OracleAdapter, :SybaseAdapter, :SQLite3Adapter)
unless current_adapter?(:OracleAdapter, :SybaseAdapter)
def test_multiparameter_attributes_on_time_only_column_with_time_zone_aware_attributes_does_not_do_time_zone_conversion
ActiveRecord::Base.time_zone_aware_attributes = true
ActiveRecord::Base.default_timezone = :utc
......@@ -876,9 +873,6 @@ def test_multiparameter_attributes_on_time_only_column_with_time_zone_aware_attr
end
def test_multiparameter_attributes_on_time_with_empty_seconds
ActiveRecord::Base.time_zone_aware_attributes = false
ActiveRecord::Base.default_timezone = :local
Time.zone = nil
attributes = {
"written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24",
"written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => ""
......@@ -910,7 +904,7 @@ def test_multiparameter_assignment_of_aggregation_with_large_index
def test_attributes_on_dummy_time
# Oracle, and Sybase do not have a TIME datatype.
return true if current_adapter?(:OracleAdapter, :SybaseAdapter, :SQLite3Adapter)
return true if current_adapter?(:OracleAdapter, :SybaseAdapter)
attributes = {
"bonus_time" => "5:42:00AM"
......
......@@ -437,7 +437,6 @@ def create_table(*args, &block)
t.string :name
t.column :updated_at, :datetime
t.column :happy_at, :datetime
t.column :eats_at, :time
t.string :essay_id
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册