Module: ActiveRecord::Materialized::WriteOutbox::Triggers

Defined in:
lib/activerecord/materialized/write_outbox.rb

Overview

Cross-engine trigger DDL. Postgres captures all three operations in one trigger function (branching on TG_OP); MySQL and SQLite need one single-operation trigger apiece. All three dialects share the same outbox shape and the same scoped-key JSON, built by SharedSql.

Defined Under Namespace

Modules: MySQL, PostgreSQL, SQLite, SharedSql Classes: Op

Class Method Summary collapse

Class Method Details

.for(connection) ⇒ Module

Returns the adapter-specific builder for connection.

Returns:

  • (Module)

    the adapter-specific builder for connection

Raises:

  • (NotImplementedError)

    for an unsupported adapter



180
181
182
183
184
185
186
187
188
189
190
# File 'lib/activerecord/materialized/write_outbox.rb', line 180

def for(connection)
  case connection.adapter_name
  when /postg/i then PostgreSQL
  when /mysql|trilogy|maria/i then MySQL
  when /sqlite/i then SQLite
  else
    raise NotImplementedError,
          "activerecord-materialized write-outbox triggers are not supported for adapter " \
          "#{connection.adapter_name.inspect}"
  end
end