Project

General

Profile

Bug #295

Updated by Daniel Curtis over 10 years ago

While trying to figure out another problem in Redmine, I ended up breaking the function of viewing issues. After trying numerous things to fix it ranging from unintalling/reinstalling the rails gem, upgrading ruby versions, and even upgrading Phusion Passenger; all to no avail. I decided to view the *log/production.log* in the redmine directory to find the following error: 
 > Processing by IssuesController#index as HTML 
 > Current user: user@example.com (id=74) 
 > Rendered queries/_filters.html.erb (64.6ms) 
 > Rendered queries/_columns.html.erb (40.9ms) 
 > Rendered issues/_list.html.erb (492.2ms) 
 > Rendered issues/_sidebar.html.erb (62.9ms) 
 > Rendered issues/index.html.erb within layouts/base (912.5ms) 
 > Completed 500 Internal Server Error in 4683ms 
 >  
 > ActionView::Template::Error (Mysql2::Error: Unknown column 'queries.is_public' in 'where clause': SELECT `queries`.`id` AS t0_r0, `queries`.`project_id` AS t0_r1, `queries`.`name` AS t0_r2, `queries`.`filters` AS t0_r3, `queries`.`user_id` AS t0_r4, `queries`.`column_names` AS t0_r5, `queries`.`sort_criteria` AS t0_r6, `queries`.`group_by` AS t0_r7, `queries`.`type` AS t0_r8, `queries`.`visibility` AS t0_r9, `queries`.`options` AS t0_r10, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11, `projects`.`inherit_members` AS t1_r12 FROM `queries` LEFT OUTER JOIN `projects` ON `projects`.`id` = `queries`.`project_id` WHERE `queries`.`type` IN ('IssueQuery') AND ((queries.project_id IS NULL OR (((projects.status <> 9 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) AND (projects.is_public = 1 OR projects.id IN (33,10,51,34,29,4,55,1,2,28,38,16,36,23,13,37,18,3,26,27,5,11,53,6,15,14,24,67,69,7,35,57,46,65,45,32,63,22,31,59,61,42,40,44,49,50,25,30,39,43,47,48,21,20,19,17,41))))) AND (queries.is_public = 1 OR queries.user_id = 4)) AND (project_id IS NULL) ORDER BY queries.name ASC): 
 > 17: <%= call_hook(:view_issues_sidebar_issues_bottom) %> 
 > 18: <%= call_hook(:view_issues_sidebar_planning_bottom) %> 
 > 19:  
 > 20: <%= render_sidebar_queries %> 
 > 21: <%= call_hook(:view_issues_sidebar_queries_bottom) %> 
 > app/helpers/issues_helper.rb:187:in `sidebar_queries' 
 > app/helpers/issues_helper.rb:214:in `render_sidebar_queries' 
 > app/views/issues/_sidebar.html.erb:20:in `_app_views_issues__sidebar_html_erb__1041431284_95856650' 
 > app/views/issues/index.html.erb:93:in `block in _app_views_issues_index_html_erb___594514544_88597730' 
 > app/helpers/application_helper.rb:1149:in `content_for' 
 > app/views/issues/index.html.erb:92:in `_app_views_issues_index_html_erb___594514544_88597730' 
 > app/controllers/issues_controller.rb:83:in `block (2 levels) in index' 
 > app/controllers/issues_controller.rb:82:in `index' 

 Due to the emergency situation, I moved the existing redmine folder and copied a known working version from a backup: 
 <pre> 
 mv /var/www/path/to/redmine /var/www/path/to/redmine.brk 
 rsync -avh -n /var/backups/path/of/backup/redmine /var/www/path/to/redmine 
 </pre> 
 Note: Remove the -n flag to initiate the actual transfer. Always dry-run rsync to prevent hazards. 

 I then refresh the bundled gems +on every instance of redmine+: 
 <pre> 
 cd /var/www/path/to/redmine 
 bundle exec rake db:migrate RAILS_ENV=production 
 </pre> 

 This still did not fix the problem. Though after reading through the redmine forum, I found that someone else encountered this issue, the solution was simple. Log into the redmine SQL database and run the following  
 statement: 
 <pre> 
 mysql -uredmine -p redmine -h redminedb 
 use redmine; 
 ALTER TABLE queries ADD is_public TINYINT NOT NULL DEFAULT 0; 
 </pre> 

 I restarted all the Web servers: 
 <pre> 
 service apache2 restart 
 </pre> 

 This fixed the problem. 

 h2. Resources 

 http://www.redmine.org/boards/2/topics/39622

Back