Module: Migratrix::Callbacks

Extended by:
ActiveSupport::Concern
Included in:
Migration
Defined in:
lib/migratrix/callbacks.rb

Overview

Migratrix Callbacks

Callbacks are hooks into the life cycle of a Migratrix Migration or Component object that allow you to trigger logic before or after an alteration of the object state. This can be used to do extra preparation or cleanup at each step along the way. Consider the Migration#migrate call:

  • (1) before_migrate

  • (2) before_extract

  • (-) extract

  • (3) after_extract

  • (4) before_transform

  • (-) transform

  • (5) after_transform

  • (6) before_load

  • (-) load

  • (7) after_load

  • (8) after_migrate

Constant Summary collapse

CALLBACKS =
[ :after_extract, :after_load, :after_migrate,
  :after_transform, :around_extract, :around_load,
  :around_migrate, :around_transform, :before_extract,
  :before_load, :before_migrate, :before_transform
]

Instance Method Summary collapse

Instance Method Details

#extractObject

:nodoc:



44
45
46
# File 'lib/migratrix/callbacks.rb', line 44

def extract #:nodoc:
  run_callbacks(:extract) { super }
end

#loadObject

:nodoc:



52
53
54
# File 'lib/migratrix/callbacks.rb', line 52

def load(*) #:nodoc:
  run_callbacks(:load) { super }
end

#migrateObject

:nodoc:



40
41
42
# File 'lib/migratrix/callbacks.rb', line 40

def migrate #:nodoc:
  run_callbacks(:migrate) { super }
end

#transformObject

:nodoc:



48
49
50
# File 'lib/migratrix/callbacks.rb', line 48

def transform(*) #:nodoc:
  run_callbacks(:transform) { super }
end