Skip to content

Commit

Permalink
Revert "Merge pull request #6344"
Browse files Browse the repository at this point in the history
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 57d534e, reversing
changes made to 20f049f.

Conflicts:

	activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
  • Loading branch information
drogus committed Jun 25, 2012
1 parent e941eaa commit ceb68d1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
Expand Up @@ -191,7 +191,7 @@ def native_database_types #:nodoc:
:decimal => { :name => "decimal" }, :decimal => { :name => "decimal" },
:datetime => { :name => "datetime" }, :datetime => { :name => "datetime" },
:timestamp => { :name => "datetime" }, :timestamp => { :name => "datetime" },
:time => { :name => "datetime" }, :time => { :name => "time" },
:date => { :name => "date" }, :date => { :name => "date" },
:binary => { :name => "blob" }, :binary => { :name => "blob" },
:boolean => { :name => "boolean" } :boolean => { :name => "boolean" }
Expand Down
Expand Up @@ -24,7 +24,7 @@ def setup
@conn.extend(LogIntercepter) @conn.extend(LogIntercepter)
@conn.intercepted = true @conn.intercepted = true
end end

def teardown def teardown
@conn.intercepted = false @conn.intercepted = false
@conn.logged = [] @conn.logged = []
Expand All @@ -43,11 +43,6 @@ def test_column_types
assert(!result.rows.first.include?("blob"), "should not store blobs") assert(!result.rows.first.include?("blob"), "should not store blobs")
end 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 def test_exec_insert
column = @conn.columns('items').find { |col| col.name == 'number' } column = @conn.columns('items').find { |col| col.name == 'number' }
vals = [[column, 10]] vals = [[column, 10]]
Expand Down
12 changes: 3 additions & 9 deletions activerecord/test/cases/base_test.rb
Expand Up @@ -504,7 +504,7 @@ def test_default_values
end end


# Oracle, and Sybase do not have a TIME datatype. # 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 def test_utc_as_time_zone
Topic.default_timezone = :utc Topic.default_timezone = :utc
attributes = { "bonus_time" => "5:42:00AM" } attributes = { "bonus_time" => "5:42:00AM" }
Expand Down Expand Up @@ -746,9 +746,6 @@ def test_multiparameter_attributes_on_time_with_raise_on_small_time_if_missing_d
end end


def test_multiparameter_attributes_on_time_will_ignore_hour_if_missing 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 = { attributes = {
"written_on(1i)" => "2004", "written_on(2i)" => "12", "written_on(3i)" => "12", "written_on(1i)" => "2004", "written_on(2i)" => "12", "written_on(3i)" => "12",
"written_on(5i)" => "12", "written_on(6i)" => "02" "written_on(5i)" => "12", "written_on(6i)" => "02"
Expand Down Expand Up @@ -855,7 +852,7 @@ def test_multiparameter_attributes_on_time_with_skip_time_zone_conversion_for_at
end end


# Oracle, and Sybase do not have a TIME datatype. # 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 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.time_zone_aware_attributes = true
ActiveRecord::Base.default_timezone = :utc ActiveRecord::Base.default_timezone = :utc
Expand All @@ -876,9 +873,6 @@ def test_multiparameter_attributes_on_time_only_column_with_time_zone_aware_attr
end end


def test_multiparameter_attributes_on_time_with_empty_seconds 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 = { attributes = {
"written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24", "written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24",
"written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => "" "written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => ""
Expand Down Expand Up @@ -910,7 +904,7 @@ def test_multiparameter_assignment_of_aggregation_with_large_index


def test_attributes_on_dummy_time def test_attributes_on_dummy_time
# Oracle, and Sybase do not have a TIME datatype. # 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 = { attributes = {
"bonus_time" => "5:42:00AM" "bonus_time" => "5:42:00AM"
Expand Down
1 change: 0 additions & 1 deletion activerecord/test/schema/schema.rb
Expand Up @@ -437,7 +437,6 @@ def create_table(*args, &block)
t.string :name t.string :name
t.column :updated_at, :datetime t.column :updated_at, :datetime
t.column :happy_at, :datetime t.column :happy_at, :datetime
t.column :eats_at, :time
t.string :essay_id t.string :essay_id
end end


Expand Down

0 comments on commit ceb68d1

Please sign in to comment.