diff options
Diffstat (limited to 'app/models/ci/project_mirror.rb')
-rw-r--r-- | app/models/ci/project_mirror.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/ci/project_mirror.rb b/app/models/ci/project_mirror.rb new file mode 100644 index 00000000000..d6aaa3f50c1 --- /dev/null +++ b/app/models/ci/project_mirror.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Ci + # This model represents a shadow table of the main database's projects table. + # It allows us to navigate the project and namespace hierarchy on the ci database. + class ProjectMirror < ApplicationRecord + belongs_to :project + + class << self + def sync!(event) + upsert({ project_id: event.project_id, namespace_id: event.project.namespace_id }, + unique_by: :project_id) + end + end + end +end |