Sha256: 842d767a8e47b7632667a7059c85c9571c757efb13edabcf8ae6397b773ade16
Contents?: true
Size: 782 Bytes
Versions: 5
Compression:
Stored size: 782 Bytes
Contents
# frozen_string_literal: true module DatabaseFlusher module ActiveRecord class PostgreSQLAdapter < AbstractAdapter private def disable_referential_integrity(*tables) begin execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";")) rescue execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER USER" }.join(";")) end yield ensure begin execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";")) rescue execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER USER" }.join(";")) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems