X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6a3cadb52d010b333a4acea8942bc4c13394e236..4e9af2b5dce9f974f69e746fea44bb06a4f38ba4:/config/initializers/postgresql_adapter.rb?ds=sidebyside diff --git a/config/initializers/postgresql_adapter.rb b/config/initializers/postgresql_adapter.rb index d8f84959c..75971e4bf 100644 --- a/config/initializers/postgresql_adapter.rb +++ b/config/initializers/postgresql_adapter.rb @@ -1,7 +1,14 @@ -if defined?(ActiveRecord::ConnectionAdaptors::PostgreSQLAdaptor) +if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) module ActiveRecord module ConnectionAdapters class PostgreSQLAdapter + def supports_disable_referential_integrity?() #:nodoc: + version = query("SHOW server_version")[0][0].split('.') + (version[0].to_i >= 9 || (version[0].to_i == 8 && version[1].to_i >= 1)) ? true : false + rescue + return false + end + def pk_and_sequence_for(table) # First try looking for a sequence with a dependency on the # given table's primary key.