projects
/
rails.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c53896e
)
Monkey patch postgres adapter for postgres 9 support
author
Tom Hughes
<tom@compton.nu>
Sun, 3 Apr 2011 16:39:06 +0000
(17:39 +0100)
committer
Tom Hughes
<tom@compton.nu>
Sun, 3 Apr 2011 16:39:06 +0000
(17:39 +0100)
config/initializers/postgresql_adapter.rb
patch
|
blob
|
history
diff --git
a/config/initializers/postgresql_adapter.rb
b/config/initializers/postgresql_adapter.rb
index d8f84959cd83f18efc7d256e78fa04f1f91f31f2..6e77a3fb0577a72092921f4554a943cc64123609 100644
(file)
--- a/
config/initializers/postgresql_adapter.rb
+++ b/
config/initializers/postgresql_adapter.rb
@@
-2,6
+2,13
@@
if defined?(ActiveRecord::ConnectionAdaptors::PostgreSQLAdaptor)
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.