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

Allow ./bin/rails to work with pending migrations

Oliver Günther3e4107eb78db
diff --git a/config/initializers/06-pending_migrations_check.rb b/config/initializers/06-pending_migrations_check.rb
index ee09e136523..605aacfbb41 100644
--- a/config/initializers/06-pending_migrations_check.rb
+++ b/config/initializers/06-pending_migrations_check.rb
@@ -28,21 +28,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-# We want to abort booting when there are missing migrations by default
-# since it can lead to runtime schema cache issues.
-# Refusing to boot will encourage admins to fix missing migrations.
-
-exceptions = %w(
- db:create db:drop
- db:migrate db:migrate:down db:migrate:redo db:migrate:up db:migrate:status
- db:prepare db:reset db:rollback
- db:structure:load db:schema:load
- db:environment:set
- db:version
- assets:precompile assets:clean
-)
is_console = Rails.const_defined? 'Console'
+no_rake_task = !(Rake.respond_to?(:application) && Rake.application.top_level_tasks.present?)
-if Rails.env.production? && !is_console && (exceptions & ARGV).empty?
+if Rails.env.production? && !is_console && no_rake_task
ActiveRecord::Migration.check_pending! # will raise an exception and abort boot
end