[1686] added some more MySQL-only syntax to Typo:
- There are two virtually identical functions in the Page and Article models that get a set of publication dates for menus. This change uses the 'date_format' function in the SELECT clause, but that function only exists in MySQL.
- There is one instance of backticks (`) being used unnecessarily to quote table names. MySQL doesn't require them in this scenario, and no other database will actually accept them.
Running 'rake' on a fresh copy with a PostgreSQL backend produces several instances of the following:
ActiveRecord::StatementInvalid in 'Admin::ContentController test_list'
PGError: ERROR: syntax error at or near "."
LINE 1: ...tions.article_id = contents.id WHERE (`contents`.id > 0) A...
Additionally, hitting /admin/pages and /admin/content produce this SQL error:
PGError: ERROR: function date_format(timestamp without time zone, "unknown") does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
: SELECT date_format(created_at, '%Y-%m') AS publication FROM contents WHERE type = 'Page' GROUP BY publication
This patch resolves all of the above issues.
Before applying this patch, I get 2 PostreSQL-related rake test errors. Both before & after applying it I one rake test error which has nothing to do with these changes:
Test::Unit::AssertionFailedError in 'Admin::UsersController rough port of the old functional test test_edit'
Password doesn't match confirmation.
<false> is not true.
./spec/controllers/admin/users_controller_spec.rb:50:in `test_edit'