diff --git a/lib/safe-pg-migrations/railtie.rb b/lib/safe-pg-migrations/railtie.rb index 7e1bb0a..484062f 100644 --- a/lib/safe-pg-migrations/railtie.rb +++ b/lib/safe-pg-migrations/railtie.rb @@ -10,33 +10,9 @@ class Railtie < Rails::Railtie ActiveRecord::Migration.singleton_class.prepend(SafePgMigrations::Migration::ClassMethods) end - break unless Object.const_defined? :StrongMigrations + next unless Object.const_defined? :StrongMigrations - StrongMigrations.add_check do |method, args| - break unless method == :add_column - - options = args.last.is_a?(Hash) ? args.last : {} - - default_value_backfill = options.fetch(:default_value_backfill, :auto) - - if default_value_backfill == :update_in_batches - check_message = <<~CHECK - default_value_backfill: :update_in_batches will take time if the table is too big. - - Your configuration sets a pause of #{SafePgMigrations.config.backfill_pause} seconds between batches of - #{SafePgMigrations.config.backfill_batch_size} rows. Each batch execution will take time as well. Please - check that the estimated duration of the migration is acceptable before adding `safety_assured`. - CHECK - - check_message += <<~CHECK if SafePgMigrations.config.default_value_backfill_threshold - - Also, please note that SafePgMigrations is configured to raise if the table has more than - #{SafePgMigrations.config.default_value_backfill_threshold} rows. - CHECK - - stop! check_message - end - end + SafePgMigrations::StrongMigrationsIntegration.initialize end end end