DEV: only enable SafeMigrate in development and test

SafeMigrate outputs text when we detect attempts to unsafely drop tables
and columns

It is unfortunately not thread safe

This is not needed in production as we would have already caught it by then
in our test suite.
This commit is contained in:
Sam Saffron 2020-04-09 13:41:03 +10:00
parent a5b582f686
commit 6b192d29fa
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
1 changed files with 8 additions and 1 deletions

View File

@ -2,4 +2,11 @@
require_dependency 'migration/safe_migrate'
# 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