X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b9c9d6c1aafdd60c72b54345b4d2dc94317298a0..51dcf86f40200bf4728097868f45aa2fe12968f3:/config/initializers/postgresql_adapter.rb 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.