刚刚学习使用redmine测试环境。当我这样做的时候:
rake db:drop db:create db:migrate redmine:plugins:migrate redmine:load_default_data RAILS_ENV=test
I got 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.
我已经删除了我安装的两个插件;它们都没有db迁移。
版本:
ruby: 3.0.4p208
redmine: 5.0.1.stable
rails: 6.1.6
迁移时,在roles表中添加了issues_visibility
列。但是,由于Role
模型类可能仍然缓存了以前的数据库模式,因此Role
模型的假设模式可能与迁移所更新的实际数据库模式不同。
要解决这个问题,您可能需要在单独的rake调用中执行redmine:load_default_data
任务,以确保在迁移后加载的默认数据使用最新的数据库模式。
rake db:drop db:create db:migrate redmine:plugins:migrate RAILS_ENV=test
rake redmine:load_default_data RAILS_ENV=test