Class: Apartment::Migrator::MigrationRun
- Inherits:
-
Data
- Object
- Data
- Apartment::Migrator::MigrationRun
- Defined in:
- lib/apartment/migrator.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#threads ⇒ Object
readonly
Returns the value of attribute threads.
-
#total_duration ⇒ Object
readonly
Returns the value of attribute total_duration.
Instance Method Summary collapse
- #failed ⇒ Object
- #skipped ⇒ Object
- #succeeded ⇒ Object
- #success? ⇒ Boolean
-
#summary ⇒ Object
rubocop:disable Metrics/AbcSize.
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results
17 18 19 |
# File 'lib/apartment/migrator.rb', line 17 def results @results end |
#threads ⇒ Object (readonly)
Returns the value of attribute threads
17 18 19 |
# File 'lib/apartment/migrator.rb', line 17 def threads @threads end |
#total_duration ⇒ Object (readonly)
Returns the value of attribute total_duration
17 18 19 |
# File 'lib/apartment/migrator.rb', line 17 def total_duration @total_duration end |
Instance Method Details
#failed ⇒ Object
23 |
# File 'lib/apartment/migrator.rb', line 23 def failed = results.select { _1.status == :failed } |
#skipped ⇒ Object
24 |
# File 'lib/apartment/migrator.rb', line 24 def skipped = results.select { _1.status == :skipped } |
#succeeded ⇒ Object
22 |
# File 'lib/apartment/migrator.rb', line 22 def succeeded = results.select { _1.status == :success } |
#success? ⇒ Boolean
25 |
# File 'lib/apartment/migrator.rb', line 25 def success? = failed.empty? |
#summary ⇒ Object
rubocop:disable Metrics/AbcSize
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/apartment/migrator.rb', line 27 def summary # rubocop:disable Metrics/AbcSize lines = [] lines << "Migrated #{results.size} tenants in #{total_duration.round(1)}s (#{threads} threads)" lines << " #{succeeded.size} succeeded" if succeeded.any? if failed.any? lines << " #{failed.size} failed:" failed.each { |r| lines << " #{r.tenant}: #{r.error&.class}: #{r.error&.}" } end lines << " #{skipped.size} skipped (up to date)" if skipped.any? lines.join("\n") end |