class Combustion::Databases::PostgreSQL

Public Instance Methods

reset() click to toggle source
Calls superclass method Combustion::Databases::Base#reset
# File lib/combustion/databases/postgresql.rb, line 4
def reset
  if Combustion::VersionGate.call("activerecord", ">= 7.1.0.alpha")
    base.connection_handler.clear_active_connections!
  else
    base.clear_active_connections!
  end

  establish_connection(postgres_configuration)

  super
end

Private Instance Methods

create() click to toggle source
# File lib/combustion/databases/postgresql.rb, line 18
def create
  connection.create_database(
    configuration[:database],
    configuration.merge(:encoding => encoding)
  )
rescue StandardError => error
  warn error, *error.backtrace
  warn "Couldn't create database for #{configuration.inspect}"
end
drop() click to toggle source
# File lib/combustion/databases/postgresql.rb, line 28
def drop
  connection.drop_database(configuration[:database])
end
encoding() click to toggle source
# File lib/combustion/databases/postgresql.rb, line 32
def encoding
  configuration[:encoding] || ENV["CHARSET"] || "utf8"
end
postgres_configuration() click to toggle source
# File lib/combustion/databases/postgresql.rb, line 36
def postgres_configuration
  configuration.merge(
    :database           => "postgres",
    :schema_search_path => schema_search_path
  )
end
schema_search_path() click to toggle source
# File lib/combustion/databases/postgresql.rb, line 43
def schema_search_path
  configuration[:adapter][/postgis/] ? "public, postgis" : "public"
end