Permalink
Browse files

Using built in postgresql_version - should be forwards compatible wit…

…h version 10+
  • Loading branch information...
1 parent b5694e7 commit a5e47d68c38014658f1bc90a10794b660d69e73a Greg Barnett committed Mar 17, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/database_cleaner/active_record/truncation.rb
@@ -60,15 +60,15 @@ def truncate_table(table_name)
class PostgreSQLAdapter < AbstractAdapter
def db_version
- @db_version ||= select_value('SHOW SERVER_VERSION')
+ @db_version ||= postgresql_version
end
def cascade
- @cascade ||= db_version >= '8.2' ? 'CASCADE' : ''
+ @cascade ||= db_version >= 80200 ? 'CASCADE' : ''
end
def restart_identity
- @restart_identity ||= db_version >= '8.4' ? 'RESTART IDENTITY' : ''
+ @restart_identity ||= db_version >= 80400 ? 'RESTART IDENTITY' : ''
end
def truncate_table(table_name)

0 comments on commit a5e47d6

Please sign in to comment.