Class: IdempotencyCheck::RowSnapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/idempotency_check/row_snapshot.rb

Overview

Snapshots full row content per table, so two snapshots can be compared to catch changes that don't alter row counts (e.g. a counter being incremented).

Only the tables the checked block wrote to are read — see SqlTracker.

Class Method Summary collapse

Class Method Details

.take(tables:, ignore_columns: []) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/idempotency_check/row_snapshot.rb', line 10

def take(tables:, ignore_columns: [])
  connection = ActiveRecord::Base.connection

  tables.each_with_object({}) do |table, rows|
    rows[table] = fetch_rows(connection, table, ignore_columns)
  end
end