Class: Database::BatchedBackgroundMigrationsFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/database/batched_background_migrations_finder.rb

Constant Summary collapse

RETURNED_MIGRATIONS =
20

Instance Method Summary collapse

Constructor Details

#initialize(params:) ⇒ BatchedBackgroundMigrationsFinder

Returns a new instance of BatchedBackgroundMigrationsFinder.



7
8
9
# File 'app/finders/database/batched_background_migrations_finder.rb', line 7

def initialize(params:)
  @params = params
end

Instance Method Details

#executeObject

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
20
21
# File 'app/finders/database/batched_background_migrations_finder.rb', line 11

def execute
  raise ArgumentError, 'database parameter is required' if params[:database].blank?

  return batched_migration_class.none unless Gitlab::Database.has_config?(database_name)

  @migrations = migrations

  filter_by_job_class_name

  @migrations.limit(RETURNED_MIGRATIONS)
end