Defect #1336
closed
After 0.6.3 -- 0.7.1 upgrade, project views fail with SQL error about "tracker_id" column
0%
Description
When installing Redmine, I initially checked out SVN tag 0.6.3, because the docs said that was the latest stable revision. Everything worked fine and I set up a few projects, issues, news items and even a forum.
Then I viewed the Redmine changelog and found that the latest stable release is actually 0.7.1. So I did an "svn switch" to the corresponding tag, and followed the upgrade instructions, including the three 'rake' commands.
Now there's one big problem: all of the project overview pages (/projects/show/xxxx) now fail to render due to a Ruby exception:
ActiveRecord::StatementInvalid (SQLite3::SQLException: no such column: tracker_id: SELECT COUNT(*) AS count_all, tracker_id AS tracker_id FROM (SELECT DISTINCT issues.id FROM issues LEFT OUTER JOIN projects ON projects.id = issues.project_id LEFT OUTER JOIN issue_statuses ON issue_statuses.id = issues.status_id LEFT OUTER JOIN trackers ON trackers.id = issues.tracker_id WHERE (projects.status=1) AND (((projects.id = 1 OR projects.parent_id = 1)) AND issue_statuses.is_closed='f') GROUP BY tracker_id )): /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/sqlite_adapter.rb:132:in `execute' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/sqlite_adapter.rb:345:in `catch_schema_changes' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/sqlite_adapter.rb:132:in `execute' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/sqlite_adapter.rb:256:in `select' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:53:in `select_all' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:74:in `cache_sql' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:53:in `select_all' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/calculations.rb:220:in `execute_grouped_calculation' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/calculations.rb:121:in `calculate' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/calculations.rb:119:in `catch' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/calculations.rb:119:in `calculate' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/calculations.rb:46:in `count' /app/controllers/projects_controller.rb:96:in `show' ....
That query does appear to be invalid, since the nested SELECT doesn't return a tracker_id column. But I don't know nearly enough about the innards of Rails to guess what's causing this.
I looked at the schema of my sqlite database, and the correct tables have 'tracker_id' columns (matching the schema.rb file).
Everything else seems to be working fine, but not being able to view a project's main page is kind of a showstopper...
Files