Module: OnlineMigrations

Extended by:
ActiveSupport::Autoload
Defined in:
lib/online_migrations.rb,
lib/online_migrations/utils.rb,
lib/online_migrations/config.rb,
lib/online_migrations/version.rb,
lib/online_migrations/migrator.rb,
lib/online_migrations/migration.rb,
lib/online_migrations/copy_trigger.rb,
lib/online_migrations/lock_retrier.rb,
lib/online_migrations/schema_cache.rb,
lib/online_migrations/schema_dumper.rb,
lib/online_migrations/batch_iterator.rb,
lib/online_migrations/database_tasks.rb,
lib/online_migrations/error_messages.rb,
lib/online_migrations/command_checker.rb,
lib/online_migrations/command_recorder.rb,
lib/online_migrations/index_definition.rb,
lib/online_migrations/verbose_sql_logs.rb,
lib/online_migrations/schema_statements.rb,
lib/online_migrations/application_record.rb,
lib/online_migrations/background_migration.rb,
lib/online_migrations/foreign_keys_collector.rb,
lib/online_migrations/change_column_type_helpers.rb,
lib/generators/online_migrations/install_generator.rb,
lib/generators/online_migrations/upgrade_generator.rb,
lib/online_migrations/background_migrations/config.rb,
lib/online_migrations/background_migrations/migration.rb,
lib/online_migrations/background_migrations/scheduler.rb,
lib/online_migrations/background_migrations/copy_column.rb,
lib/online_migrations/background_migrations/migration_job.rb,
lib/online_migrations/background_schema_migrations/config.rb,
lib/online_migrations/background_migrations/reset_counters.rb,
lib/online_migrations/background_migrations/backfill_column.rb,
lib/online_migrations/background_migrations/migration_runner.rb,
lib/online_migrations/background_schema_migrations/migration.rb,
lib/online_migrations/background_schema_migrations/scheduler.rb,
lib/online_migrations/background_migrations/migration_helpers.rb,
lib/generators/online_migrations/background_migration_generator.rb,
lib/online_migrations/background_migrations/migration_job_runner.rb,
lib/online_migrations/background_migrations/delete_orphaned_records.rb,
lib/online_migrations/background_schema_migrations/migration_runner.rb,
lib/online_migrations/background_schema_migrations/migration_helpers.rb,
lib/online_migrations/background_migrations/delete_associated_records.rb,
lib/online_migrations/background_migrations/migration_status_validator.rb,
lib/online_migrations/background_migrations/perform_action_on_relation.rb,
lib/online_migrations/background_migrations/migration_job_status_validator.rb,
lib/online_migrations/background_schema_migrations/migration_status_validator.rb,
lib/online_migrations/background_migrations/background_migration_class_validator.rb

Defined Under Namespace

Modules: BackgroundMigrations, BackgroundSchemaMigrations, ChangeColumnTypeHelpers, Migration, SchemaDumper, SchemaStatements Classes: ApplicationRecord, BackgroundMigration, Config, ConstantLockRetrier, Error, ExponentialLockRetrier, LockRetrier, UnsafeMigration, WrappedConnection

Constant Summary collapse

VERSION =
"0.25.0"

Class Method Summary collapse

Class Method Details

.configObject



81
82
83
# File 'lib/online_migrations.rb', line 81

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



77
78
79
# File 'lib/online_migrations.rb', line 77

def configure
  yield config
end

.deprecatorObject



104
105
106
107
108
109
110
111
# File 'lib/online_migrations.rb', line 104

def deprecator
  @deprecator ||=
    if Utils.ar_version >= 7.1
      ActiveSupport::Deprecation.new(nil, "online_migrations")
    else
      ActiveSupport::Deprecation
    end
end

.run_background_migrations(**options) ⇒ Object Also known as: run_background_data_migrations

Run background data migrations

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :shard (String, Symbol, nil)

    The name of the shard to run background data migrations on. By default runs on all shards.



90
91
92
# File 'lib/online_migrations.rb', line 90

def run_background_migrations(**options)
  BackgroundMigrations::Scheduler.run(**options)
end

.run_background_schema_migrations(**options) ⇒ Object

Run background schema migrations

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :shard (String, Symbol, nil)

    The name of the shard to run background schema migrations on. By default runs on all shards.



100
101
102
# File 'lib/online_migrations.rb', line 100

def run_background_schema_migrations(**options)
  BackgroundSchemaMigrations::Scheduler.run(**options)
end