Remove FDW related code for container repositories

Since GitLab 13.2 we don't rely on FDW queries
to sync these repositories.
parent 27acad5e
# frozen_string_literal: true
module Geo
module Fdw
class ContainerRepository < ::Geo::BaseFdw
self.table_name = Gitlab::Geo::Fdw.foreign_table_name('container_repositories')
self.primary_key = :id
belongs_to :project, class_name: 'Geo::Fdw::Project', inverse_of: :container_repositories
scope :project_id_in, ->(ids) { joins(:project).merge(Geo::Fdw::Project.id_in(ids)) }
class << self
def inner_join_container_repository_registry
join_statement =
arel_table
.join(container_repository_registry_table, Arel::Nodes::InnerJoin)
.on(arel_table[:id].eq(container_repository_registry_table[:container_repository_id]))
joins(join_statement.join_sources)
end
def missing_container_repository_registry
left_outer_join_container_repository_registry
.where(container_repository_registry_table[:id].eq(nil))
end
private
def container_repository_registry_table
Geo::ContainerRepositoryRegistry.arel_table
end
def left_outer_join_container_repository_registry
join_statement =
arel_table
.join(container_repository_registry_table, Arel::Nodes::OuterJoin)
.on(arel_table[:id].eq(container_repository_registry_table[:container_repository_id]))
joins(join_statement.join_sources)
end
end
end
end
end
...@@ -8,8 +8,6 @@ module Geo ...@@ -8,8 +8,6 @@ module Geo
self.primary_key = :id self.primary_key = :id
self.table_name = Gitlab::Geo::Fdw.foreign_table_name('projects') self.table_name = Gitlab::Geo::Fdw.foreign_table_name('projects')
has_many :container_repositories, class_name: 'Geo::Fdw::ContainerRepository'
belongs_to :namespace, class_name: 'Geo::Fdw::Namespace' belongs_to :namespace, class_name: 'Geo::Fdw::Namespace'
alias_method :parent, :namespace alias_method :parent, :namespace
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Geo::Fdw::ContainerRepository, :geo, type: :model do
context 'relationships' do
it { is_expected.to belong_to(:project).class_name('Geo::Fdw::Project') }
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Geo::Fdw::Project, :geo_fdw, type: :model do
context 'relationships' do
it { is_expected.to have_many(:container_repositories).class_name('Geo::Fdw::ContainerRepository') }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment