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

Avoid logging with log delegator in migrations (#9150)

Oliver Günther16446cd80b42
diff --git a/config/initializers/log_slow_sql_queries.rb b/config/initializers/log_slow_sql_queries.rb
index 4438fec78be..f592121daf4 100644
--- a/config/initializers/log_slow_sql_queries.rb
+++ b/config/initializers/log_slow_sql_queries.rb
@@ -2,6 +2,9 @@ OpenProject::Application.configure do
config.after_initialize do
next if Rails.env.test?
+ # Avoid running this on migrations or when the database is incomplete
+ next if OpenProject::Database.migrations_pending?
+
slow_sql_threshold = OpenProject::Configuration.sql_slow_query_threshold.to_i
next if slow_sql_threshold == 0