Module: ActiveRecord::Materialized::Metadata::MaintenancePayload Private

Extended by:
T::Sig
Defined in:
lib/activerecord/materialized/metadata/maintenance_payload.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Reads and writes the serialized pending-maintenance payload on the metadata row.

Class Method Summary collapse

Class Method Details

.clear!(metadata) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
# File 'lib/activerecord/materialized/metadata/maintenance_payload.rb', line 27

def self.clear!()
  .record.update!(maintenance_payload: nil)
end

.fetch(metadata) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
# File 'lib/activerecord/materialized/metadata/maintenance_payload.rb', line 19

def self.fetch()
  raw = T.unsafe(.record).maintenance_payload
  return nil if raw.blank?

  JSON.parse(raw)
end

.record!(metadata, payload) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/activerecord/materialized/metadata/maintenance_payload.rb', line 14

def self.record!(, payload)
  .record.update!(maintenance_payload: payload.to_json)
end