Class: OnlineMigrations::BackgroundSchemaMigrations::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/online_migrations/background_schema_migrations/config.rb

Overview

Class representing configuration options for background schema migrations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



33
34
35
36
37
# File 'lib/online_migrations/background_schema_migrations/config.rb', line 33

def initialize
  @max_attempts = 5
  @statement_timeout = 1.hour
  @error_handler = ->(error, errored_migration) {}
end

Instance Attribute Details

#error_handlerProc

The callback to perform when an error occurs in the migration.

Examples:

OnlineMigrations.config.background_schema_migrations.error_handler = ->(error, errored_migration) do
  Bugsnag.notify(error) do |notification|
    notification.(:background_schema_migration, { name: errored_migration.name })
  end
end

Returns:

  • (Proc)

    the callback to perform when an error occurs in the migration



31
32
33
# File 'lib/online_migrations/background_schema_migrations/config.rb', line 31

def error_handler
  @error_handler
end

#max_attemptsInteger

Maximum number of run attempts

When attempts are exhausted, the migration is marked as failed.

Returns:

  • (Integer)

    defaults to 5



12
13
14
# File 'lib/online_migrations/background_schema_migrations/config.rb', line 12

def max_attempts
  @max_attempts
end

#statement_timeoutInteger

Statement timeout value used when running background schema migration.

Returns:

  • (Integer)

    defaults to 1 hour



18
19
20
# File 'lib/online_migrations/background_schema_migrations/config.rb', line 18

def statement_timeout
  @statement_timeout
end