interface

SQL.PostgresOrMySQLOptions

interface PostgresOrMySQLOptions

  • adapter?: 'postgres' | 'mysql' | 'mariadb'

    Database adapter/driver to use

  • allowPublicKeyRetrieval?: boolean

    MySQL only. Allow the client to request the server's RSA public key during caching_sha2_password / sha256_password authentication when the connection is not protected by TLS. Disabled by default because a network attacker can substitute their own key and recover the plaintext password. Enable only for trusted local connections, or use TLS instead.

  • bigint?: boolean

    Return values outside the i32 range as BigInt. By default they are returned as strings.

  • connection?: Record<string, string | number | boolean>

    Postgres client runtime configuration options

  • connectionTimeout?: number

    Maximum time in seconds to wait when establishing a connection

  • database?: string

    Name of the database to connect to

  • hostname?: string

    Database server hostname

  • idleTimeout?: number

    Maximum time in seconds a connection can sit idle before it is closed

  • max?: number

    Maximum number of connections in the pool

  • maxLifetime?: number

    Maximum lifetime in seconds of a connection

  • onclose?: (err: null | Error) => void

    Called when a connection is closed. Receives the closing Error, or null.

  • onconnect?: (err: null | Error) => void

    Called when a connection attempt completes. Receives an Error on failure, or null on success.

  • password?: string | () => MaybePromise<string>

    Database password for authentication

  • path?: string

    Unix domain socket path for connection

  • port?: string | number

    Database server port number

  • prepare?: boolean

    Automatic creation of prepared statements

  • tls?: boolean | BunFile | 'require' | TLSOptions | 'disable' | 'allow' | 'prefer' | 'verify-ca' | 'verify-full'

    Whether to use TLS/SSL for the connection. A string selects the SSL mode ("disable", "allow", "prefer", "require", "verify-ca", "verify-full").

  • url?: string | URL

    Connection URL, for example postgres://user:pass@localhost:5432/mydb

  • username?: string

    Database user for authentication