class method self.dbconsole

Ruby on Rails 7.2.3

Since v7.1.6

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

self.dbconsole(config, options = {})

No documentation comment.

Parameters

config req
options opt = {}
Source
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 73
        def dbconsole(config, options = {})
          pg_config = config.configuration_hash

          ENV["PGUSER"]         = pg_config[:username] if pg_config[:username]
          ENV["PGHOST"]         = pg_config[:host] if pg_config[:host]
          ENV["PGPORT"]         = pg_config[:port].to_s if pg_config[:port]
          ENV["PGPASSWORD"]     = pg_config[:password].to_s if pg_config[:password] && options[:include_password]
          ENV["PGSSLMODE"]      = pg_config[:sslmode].to_s if pg_config[:sslmode]
          ENV["PGSSLCERT"]      = pg_config[:sslcert].to_s if pg_config[:sslcert]
          ENV["PGSSLKEY"]       = pg_config[:sslkey].to_s if pg_config[:sslkey]
          ENV["PGSSLROOTCERT"]  = pg_config[:sslrootcert].to_s if pg_config[:sslrootcert]
          if pg_config[:variables]
            ENV["PGOPTIONS"] = pg_config[:variables].filter_map do |name, value|
              "-c #{name}=#{value.to_s.gsub(/[ \\]/, '\\\\\0')}" unless value == ":default" || value == :default
            end.join(" ")
          end
          find_cmd_and_exec("psql", config.database)
        end

Defined in activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb line 73 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

Type at least 2 characters to search.

↑↓ navigate · open · esc close