Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

use connection pool to check for pending migrations

Klaus Zandersfc849f3669a2
diff --git a/app/models/journable/timestamps.rb b/app/models/journable/timestamps.rb
index 2f49da5e546..ec6d54f3394 100644
--- a/app/models/journable/timestamps.rb
+++ b/app/models/journable/timestamps.rb
@@ -71,7 +71,7 @@ module Journable::Timestamps
end
prepended do
- if ActiveRecord::Base.connected? and not ActiveRecord::Base.connection.migration_context.needs_migration?
+ if ActiveRecord::Base.connected? and not ActiveRecord::Base.connection.pool.migration_context.needs_migration?
column_names_missing_in_journal.each do |missing_column_name|
define_method missing_column_name do
if historic?
diff --git a/lib_static/open_project/database.rb b/lib_static/open_project/database.rb
index 6f7277481b7..2e127e94a9e 100644
--- a/lib_static/open_project/database.rb
+++ b/lib_static/open_project/database.rb
@@ -70,7 +70,7 @@ module OpenProject
# Ensure cache is busted if result is positive or unset
# and the value was cached
if ensure_fresh || cached_result != false
- fresh_result = connection.migration_context.needs_migration?
+ fresh_result = connection.pool.migration_context.needs_migration?
Rails.cache.write(cache_key, expires_in: 1.hour)
return fresh_result
end