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

background_migrations.rb « migration « cop « rubocop - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7dcc2101fb14b056213c3a50401da0dda6f15091 (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
28
# frozen_string_literal: true

require_relative '../../migration_helpers'

module RuboCop
  module Cop
    module Migration
      class BackgroundMigrations < RuboCop::Cop::Base
        include MigrationHelpers

        MSG = 'Background migrations are deprecated. Please use a Batched Background Migration instead.'\
              ' More info: https://docs.gitlab.com/ee/development/database/batched_background_migrations.html'

        def on_send(node)
          name = node.children[1]

          disabled_methods = %i(
            queue_background_migration_jobs_by_range_at_intervals
            requeue_background_migration_jobs_by_range_at_intervals
            migrate_in
          )

          add_offense(node.loc.selector) if disabled_methods.include? name
        end
      end
    end
  end
end