mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:57:15 +08:00
Revert "We have had errors reported due to migrations breaking and are reverting"
This reverts commit 8b46f14744d4bab9339d075825914d86da6bd5eb. It corrects the reason for the revert: We rely on SafeMigrate existing cause we call it from migrations, Zeitwerk will autoload it. Instead of previous pattern we explicitly bypass all the hacks in production mode. We need to disable SafeMigrate cause it is not thread safe. A thread safe implementation is possible but not worth the effort, we catch the issues in dev and test.
This commit is contained in:
@ -1,5 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_dependency 'migration/safe_migrate'
|
||||
|
||||
Migration::SafeMigrate.patch_active_record!
|
||||
# We do not run this in production cause it is intrusive and has
|
||||
# potential to break stuff, it also breaks under concurrent use
|
||||
# which rake:multisite_migrate uses
|
||||
#
|
||||
# The protection is only needed in Dev and Test
|
||||
if ENV['RAILS_ENV'] != "production"
|
||||
require_dependency 'migration/safe_migrate'
|
||||
Migration::SafeMigrate.patch_active_record!
|
||||
end
|
||||
|
Reference in New Issue
Block a user