Class: Projects::SyncEvent

Inherits:
ApplicationRecord show all
Defined in:
app/models/projects/sync_event.rb

Overview

This model serves to keep track of changes to the namespaces table in the main database as they relate to projects, allowing to safely replicate changes to other databases.

Constant Summary

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

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

#serializable_hash

Class Method Details

.enqueue_workerObject


13
14
15
# File 'app/models/projects/sync_event.rb', line 13

def self.enqueue_worker
  ::Projects::ProcessSyncEventsWorker.perform_async # rubocop:disable CodeReuse/Worker
end

.upper_bound_countObject


17
18
19
# File 'app/models/projects/sync_event.rb', line 17

def self.upper_bound_count
  select('COALESCE(MAX(id) - MIN(id) + 1, 0) AS upper_bound_count').to_a.first.upper_bound_count
end