Skip to content

A platform for community discussion. Free, open, simple.

DEV: only enable SafeMigrate in development and test

Sam Saffron6b192d29fa09
diff --git a/lib/freedom_patches/safe_migrations.rb b/lib/freedom_patches/safe_migrations.rb
index 718ffffb89f..161d9fa8a7c 100644
--- a/lib/freedom_patches/safe_migrations.rb
+++ b/lib/freedom_patches/safe_migrations.rb
@@ -2,4 +2,11 @@
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"
+ Migration::SafeMigrate.patch_active_record!
+end