Sha256: 4accf56d70add89f1e5816ee507575e7d4ca1663bdae2ff56244cc6c84e3ecc5
Contents?: true
Size: 921 Bytes
Versions: 8
Compression:
Stored size: 921 Bytes
Contents
# frozen_string_literal: true module DatabaseFlusher module ActiveRecord class AbstractAdapter attr_reader :connection, :raw_connection def initialize(connection) @connection = connection @raw_connection = connection.raw_connection end def delete(*tables) disable_referential_integrity(*tables) do stmts = tables.map do |name| "DELETE FROM #{quote_table_name(name)}" end sql = stmts.join(';') execute_multi sql end end private def execute_multi(sql) connection.execute sql end def execute(sql) connection.execute sql end def quote_table_name(name) connection.quote_table_name(name) end def disable_referential_integrity(*tables, &block) connection.disable_referential_integrity(&block) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems