Module: StrongMigrations::DatabaseTasks

Defined in:
lib/strong_migrations/database_tasks.rb

Instance Method Summary collapse

Instance Method Details

#migrateObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/strong_migrations/database_tasks.rb', line 3

def migrate(...)
  super
rescue => e
  if e.cause.is_a?(StrongMigrations::Error)
    # strip cause and clean backtrace
    def e.cause
      nil
    end

    def e.message
      super.sub("\n\n\n", "\n\n") + "\n"
    end

    unless Rake.application.options.trace
      def e.backtrace
        bc = ActiveSupport::BacktraceCleaner.new
        bc.add_silencer { |line| line =~ /strong_migrations/ }
        bc.clean(super)
      end
    end
  end

  raise e
end