]> source.dussan.org Git - sonarqube.git/blob
715a63ae7c8bfef05c1be1b3f72df58a6faefe71
[sonarqube.git] /
1 # Don't need to load native postgres adapter
2 $LOADED_FEATURES << "active_record/connection_adapters/postgresql_adapter.rb"
3
4 class ActiveRecord::Base
5   class << self
6     def postgresql_connection(config)
7       require "arjdbc/postgresql"
8       config[:host] ||= "localhost"
9       config[:port] ||= 5432
10       config[:url] ||= "jdbc:postgresql://#{config[:host]}:#{config[:port]}/#{config[:database]}"
11       config[:url] << config[:pg_params] if config[:pg_params]
12       config[:driver] ||= "org.postgresql.Driver"
13       conn = jdbc_connection(config)
14       conn.execute("SET SEARCH_PATH TO #{config[:schema_search_path]}") if config[:schema_search_path]
15       conn
16     end
17     alias_method :jdbcpostgresql_connection, :postgresql_connection
18   end
19 end
20
21