Sha256: 906817b5225f7b486694f1b0e3f7b4300dad14ba36fc969052fe299e7fd2a656
Contents?: true
Size: 760 Bytes
Versions: 1
Compression:
Stored size: 760 Bytes
Contents
module DatabaseFlusher module ActiveRecord class PostgreSQLAdapter < AbstractAdapter private def disable_referential_integrity(*tables, &block) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
database_flusher-0.2.0 | lib/database_flusher/active_record/adapters/postgresql_adapter.rb |