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

base_move_relations_service.rb « projects « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 24dec1f3a45e4a018c46a40b162c62c134b1527a (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
# frozen_string_literal: true

module Projects
  class BaseMoveRelationsService < BaseService
    attr_reader :source_project
    def execute(source_project, remove_remaining_elements: true)
      return if source_project.blank?

      @source_project = source_project

      true
    end

    private

    # rubocop: disable CodeReuse/ActiveRecord
    def prepare_relation(relation, id_param = :id)
      if Gitlab::Database.postgresql?
        relation
      else
        relation.model.where("#{id_param}": relation.pluck(id_param))
      end
    end
    # rubocop: enable CodeReuse/ActiveRecord
  end
end