// the find
palkan/logidze
Database changes log for Rails
Logidze is a PostgreSQL-backed audit log for ActiveRecord models. It stores change history as JSONB inside the record itself using DB-level triggers, giving you time-travel queries without a separate audit table. Rails/Postgres shops that want PaperTrail-style versioning with better write performance.
Trigger-based logging means the history is captured even if you bypass ActiveRecord (raw SQL, bulk updates with `update_all` inside a `without_logging` block aside). JSONB-in-row storage avoids the N+1 join that kills PaperTrail at scale — the benchmark charts are included and credible. The `#at(time:)` / `#diff_from(time:)` / `#undo!` API is clean and covers 90% of real audit use cases without ceremony. The new `--detached` mode storing history in a separate `logidze_data` table is a genuine escape hatch for tables that would bloat badly.
Deletes are a hard gap — the record is gone and so is its history, full stop. The README acknowledges this and points you to a separate lib, but for anything with compliance requirements that's a non-starter without additional tooling. Requiring `config.active_record.schema_format = :sql` or the `fx` gem is a real friction point — teams with established `schema.rb` workflows will hit this on day one and it's buried in a NOTE. The `with_meta` / `with_responsible` connection-level state via `SET LOCAL` is subtle: PgBouncer transaction-mode pooling will corrupt it silently, and the README warning is easy to miss. Associations versioning is experimental and hidden in the wiki, so if you need to time-travel across `has_many` relationships you're mostly on your own.