Class: OnlineMigrations::BackgroundSchemaMigrations::MigrationRunner
- Inherits:
-
Object
- Object
- OnlineMigrations::BackgroundSchemaMigrations::MigrationRunner
- Defined in:
- lib/online_migrations/background_schema_migrations/migration_runner.rb
Overview
Runs single background schema migration.
Instance Attribute Summary collapse
-
#migration ⇒ Object
readonly
Returns the value of attribute migration.
Instance Method Summary collapse
-
#initialize(migration) ⇒ MigrationRunner
constructor
A new instance of MigrationRunner.
- #run ⇒ Object
Constructor Details
#initialize(migration) ⇒ MigrationRunner
Returns a new instance of MigrationRunner.
9 10 11 |
# File 'lib/online_migrations/background_schema_migrations/migration_runner.rb', line 9 def initialize(migration) @migration = migration end |
Instance Attribute Details
#migration ⇒ Object (readonly)
Returns the value of attribute migration.
7 8 9 |
# File 'lib/online_migrations/background_schema_migrations/migration_runner.rb', line 7 def migration @migration end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/online_migrations/background_schema_migrations/migration_runner.rb', line 13 def run return if migration.cancelled? || migration.succeeded? mark_as_running if migration.enqueued? || migration.failed? if migration.composite? migration.children.each do |child_migration| runner = self.class.new(child_migration) runner.run end else do_run end end |