class DatabaseFlusher::ActiveRecord::DeletionStrategy::Subscriber

Constants

PATTERN

INSERT [IGNORE] [INTO] schema_name.table_name

Public Class Methods

new(strategy) click to toggle source
# File lib/database_flusher/active_record/deletion_strategy.rb, line 24
def initialize(strategy)
  @strategy = strategy
end

Public Instance Methods

call(_, _, _, _, payload) click to toggle source
# File lib/database_flusher/active_record/deletion_strategy.rb, line 28
def call(_, _, _, _, payload)
  sql = payload[:sql]
  match = sql.match(PATTERN)
  return unless match
  table  = match[2]
  if table
    schema = match[1]
    if schema
      table = "#{schema}.#{table}"
    end
    @strategy.tables << table
  end
end