Class: Ci::NamespaceMirror
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ci::NamespaceMirror
- Includes:
- FromUnion
- Defined in:
- app/models/ci/namespace_mirror.rb
Overview
This model represents a record in a shadow table of the main database’s namespaces table. It allows us to navigate the namespace hierarchy on the ci database without resorting to a JOIN.
Constant Summary
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary collapse
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Class Method Details
.sync!(event) ⇒ Object
40 41 42 43 44 45 |
# File 'app/models/ci/namespace_mirror.rb', line 40 def sync!(event) namespace = event.namespace traversal_ids = namespace.self_and_ancestor_ids(hierarchy_order: :desc) upsert({ namespace_id: event.namespace_id, traversal_ids: traversal_ids }, unique_by: :namespace_id) end |