TIME data types in sqlite

Hi all,

During working on the patch for ticket #11425 [1] I noticed that test_sqlite3 gave failures for test/cases/base_test.rb that it didn’t give when the full test suite was run. That ticket got committed as this seemed to be a separate issue, and I’m pleased to say I’ve worked it out; you can’t use ActiveRecord to create a TIME column in sqlite, even though the test/schema/sqlite.sql creates a TIME column for topics.bonus_time. The fix is to change native_database_types in sqlite_adaptor.rb to map :time to {:name => ‘time’} rather than {:name => ‘datetime’}.

Ticket 11465 [2] has a patch to fix this, but I’ve only tested it on sqlite3 (ver 3.5.6 of sqlite3) and it could probably do with some tests on other versions of sqlite3 (and sqlite) just to make sure it doesn’t break anything unexpectedly. Although, as I said in the patch, sqlite.sql defines topic.bonus_time as TIME way back in changeset 40 [3] (from 2004), so I’d imagine it’s safe enough for all versions of sqlite3 and sqlite that date back to then.

Anyway, this could probably do with some eyeballs (and any suggestions of more tests for proof if you can think of any)



[1] http://dev.rubyonrails.org/ticket/11425
[2] http://dev.rubyonrails.org/ticket/11465
[3] http://dev.rubyonrails.org/changeset/40