From 9c90a2e12803c204300be3e2429867782f3be7b4 Mon Sep 17 00:00:00 2001 From: Xiao Jia Date: Wed, 18 Oct 2023 12:44:19 -0700 Subject: [PATCH] nsbox: fix an error during db:migrate During the initial migration, the settings table has not been created yet, so the following error is raised: ActiveRecord::StatementInvalid: Could not find table 'settings' --- lib/redmine/preparation.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/redmine/preparation.rb b/lib/redmine/preparation.rb index dba507b26..507414c53 100644 --- a/lib/redmine/preparation.rb +++ b/lib/redmine/preparation.rb @@ -177,8 +177,12 @@ def self.prepare :if => Proc.new {!User.current.logged? && Setting.self_registration?} menu.push :my_account, {:controller => 'my', :action => 'account'}, :if => Proc.new {User.current.logged?} - menu.push :logout, '/OIDCRedirectURI?logout=https%3A%2F%2F' + ERB::Util.url_encode(Setting.host_name) + '%2F', - :if => Proc.new {User.current.logged?} + unless ARGV.include? 'db:migrate' + # Setting.host_name needs to query the database, so we need to avoid + # calling it during the (initial) migration. + menu.push :logout, '/OIDCRedirectURI?logout=https%3A%2F%2F' + ERB::Util.url_encode(Setting.host_name) + '%2F', + :if => Proc.new {User.current.logged?} + end end MenuManager.map :application_menu do |menu|