Module: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::ReferentialIntegrity
- Included in:
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Defined in:
- activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
Instance Method Summary collapse
-
#disable_referential_integrity ⇒ Object
:nodoc:.
-
#supports_disable_referential_integrity? ⇒ Boolean
:nodoc:.
Instance Method Details
#disable_referential_integrity ⇒ Object
:nodoc:
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb', line 9 def disable_referential_integrity #:nodoc: if supports_disable_referential_integrity? 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 end yield ensure if supports_disable_referential_integrity? 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 |
#supports_disable_referential_integrity? ⇒ Boolean
:nodoc:
5 6 7 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb', line 5 def supports_disable_referential_integrity? #:nodoc: true end |