redmine test db load failure

Viewed 23

Just learning to use the redmine test environment. When I do this:

rake db:drop db:create db:migrate redmine:plugins:migrate redmine:load_default_data RAILS_ENV=test

I get a failure:

-- drop_table(:open_id_authentication_nonces)
   -> 0.0114s
== 20211213122101 DropOpenIdAuthenticationTables: migrated (0.0194s) ==========

== 20211213122102 RemoveOpenIdSetting: migrating ==============================
== 20211213122102 RemoveOpenIdSetting: migrated (0.0012s) =====================

== 20220224194639 DeleteOrphanedTimeEntryActivities: migrating ================
== 20220224194639 DeleteOrphanedTimeEntryActivities: migrated (0.0088s) =======


Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] 
====================================    
Error: unknown attribute 'issues_visibility' for Role.

I have removed the two plugins I had installed; neither of them had db migrations.

Versions:

ruby:    3.0.4p208
redmine: 5.0.1.stable
rails:   6.1.6
1 Answers

The issues_visibility column is added to the roles table in a migration. However, as the Role model class probably still has cached a previous database schema, the assumed schema of the Role model might differ from the actual database schema as updated by the migrations.

To fix this, you may want to perform the redmine:load_default_data task in a separate rake invocation to make sure that the default data loaded uses the most up-to-date database schema after the migrations.

rake db:drop db:create db:migrate redmine:plugins:migrate RAILS_ENV=test
rake redmine:load_default_data RAILS_ENV=test
Related