Merge pull request #10029 from opf/fix/pending-migrations-check

Allow ./bin/rails to work with pending migrations
pull/10035/head
Oliver Günther 3 years ago committed by GitHub
commit 42e438dd4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      config/initializers/06-pending_migrations_check.rb

@ -28,21 +28,10 @@
# 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?)
no_override = ENV['OPENPROJECT_DISABLE__MIGRATIONS__CHECK'] != 'true'
if Rails.env.production? && !is_console && (exceptions & ARGV).empty?
if Rails.env.production? && !is_console && no_rake_task && no_override
ActiveRecord::Migration.check_pending! # will raise an exception and abort boot
end

Loading…
Cancel
Save