Monkey patch postgres adapter for postgres 9 support
This commit is contained in:
parent
c53896e453
commit
a9e8f14e6d
1 changed files with 7 additions and 0 deletions
|
@ -2,6 +2,13 @@ if defined?(ActiveRecord::ConnectionAdaptors::PostgreSQLAdaptor)
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module ConnectionAdapters
|
module ConnectionAdapters
|
||||||
class PostgreSQLAdapter
|
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)
|
def pk_and_sequence_for(table)
|
||||||
# First try looking for a sequence with a dependency on the
|
# First try looking for a sequence with a dependency on the
|
||||||
# given table's primary key.
|
# given table's primary key.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue