2022-07-23 23:45:48 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative '../../migration_helpers'
|
|
|
|
|
|
|
|
module RuboCop
|
|
|
|
module Cop
|
|
|
|
module Migration
|
2022-10-11 01:57:18 +05:30
|
|
|
class BackgroundMigrations < RuboCop::Cop::Base
|
2022-07-23 23:45:48 +05:30
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
add_offense(node.loc.selector) if disabled_methods.include? name
|
2022-07-23 23:45:48 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|