Project

General

Profile

Error missing table in database

Added by Thomas C over 9 years ago

Hi everybody, I have an error 500 when accessing issues with a standard user :

App 23902 stderr: ActiveRecord::StatementInvalid (Mysql2::Error: Table 'redmine.custom_fields_roles' doesn't exist: SELECT `custom_fields`.* FROM `custom_fields`  WHERE `custom_fields`.`type` IN ('IssueCustomField') AND `custom_fields`.`is_filter` = 1 AND (is_for_all = 1 OR id IN (SELECT DISTINCT cfp.custom_field_id FROM custom_fields_projects cfp WHERE cfp.project_id = 16)) AND (custom_fields.visible = 1 OR custom_fields.id IN (SELECT DISTINCT cfr.custom_field_id FROM members m INNER JOIN member_roles mr ON mr.member_id = m.id INNER JOIN custom_fields_roles cfr ON cfr.role_id = mr.role_id WHERE m.user_id = 3)) ORDER BY custom_fields.position ASC):
App 23902 stderr:   app/models/query.rb:790:in `add_custom_fields_filters'
App 23902 stderr:   app/models/issue_query.rb:235:in `initialize_available_filters'
App 23902 stderr:   app/models/query.rb:331:in `available_filters'
App 23902 stderr:   app/models/query.rb:220:in `build_from_params'
App 23902 stderr:   app/models/issue_query.rb:119:in `build_from_params'
App 23902 stderr:   app/helpers/queries_helper.rb:175:in `retrieve_query'
App 23902 stderr:   app/controllers/issues_controller.rb:56:in `index'

For any projects.

From the admin account, it works. I checked the database, the table redmine.custom_fields_roles doesn't exists. What can I do to fix that without losing my data ?
Thank you !

Edit :
New info => I made a new user, same problem.
I tried updating Redmine from 2.4 to 2.5.2, it works, the migration script gave no error, but I still have the problem.


Replies (1)

RE: Error missing table in database - Added by Thomas C over 9 years ago

Hi, I fixed my problem. The error was that "rake db:migrate RAILS_ENV=production" didn't fix the missing table. I use mysql. With a backup of my database, I dropped the redmine database on mysql. I ran rake db:migrate RAILS_ENV=production on the redmine folder to recreate the structure. It added missing tables.

Then I loaded my backup : mysql -uredmine redmine < redminebackup (no drop all tables in it)
And ran again rake db:migrate RAILS_ENV=production to fix some tables.

Now it works !

    (1-1/1)