Welcome to mirror list, hosted at ThFree Co, Russian Federation.

batched_background_migrations_finder.rb « database « finders « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 866acd47238bcbe7efddda22b13383cc8f1b3d46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Database
  class BatchedBackgroundMigrationsFinder
    RETURNED_MIGRATIONS = 20

    def initialize(connection:)
      @connection = connection
    end

    def execute
      batched_migration_class.ordered_by_created_at_desc.for_gitlab_schema(schema).limit(RETURNED_MIGRATIONS)
    end

    private

    attr_accessor :connection

    def batched_migration_class
      Gitlab::Database::BackgroundMigration::BatchedMigration
    end

    def schema
      Gitlab::Database.gitlab_schemas_for_connection(connection)
    end
  end
end