Skip to content

Latest commit

 

History

History
1626 lines (1169 loc) · 58.9 KB

pg.md

File metadata and controls

1626 lines (1169 loc) · 58.9 KB

heroku pg

manage postgresql databases

heroku pg [DATABASE]

show database information

USAGE
  $ heroku pg [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use all
            databases.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show database information

ALIASES
  $ heroku pg

heroku pg:backups

list database backups

USAGE
  $ heroku pg:backups -a <value> [-r <value>]

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  list database backups

See code: src/commands/pg/backups/index.ts

heroku pg:backups:cancel [BACKUP_ID]

cancel an in-progress backup or restore (default newest)

USAGE
  $ heroku pg:backups:cancel [BACKUP_ID] -a <value> [-r <value>]

ARGUMENTS
  BACKUP_ID  ID of the backup. If omitted, we use the last unfinished backup ID.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  cancel an in-progress backup or restore (default newest)

See code: src/commands/pg/backups/cancel.ts

heroku pg:backups:capture [DATABASE]

capture a new backup

USAGE
  $ heroku pg:backups:capture [DATABASE] -a <value> [--wait-interval <value>] [-v] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>            (required) app to run command against
  -r, --remote=<value>         git remote of app to use
  -v, --verbose
  --wait-interval=<value>

DESCRIPTION
  capture a new backup

See code: src/commands/pg/backups/capture.ts

heroku pg:backups:delete BACKUP_ID

delete a backup

USAGE
  $ heroku pg:backups:delete BACKUP_ID -a <value> [-c <value>] [-r <value>]

ARGUMENTS
  BACKUP_ID  ID of the backup

FLAGS
  -a, --app=<value>      (required) app to run command against
  -c, --confirm=<value>
  -r, --remote=<value>   git remote of app to use

DESCRIPTION
  delete a backup

EXAMPLES
  $ heroku pg:backup:delete --app APP_ID BACKUP_ID

See code: src/commands/pg/backups/delete.ts

heroku pg:backups:download [BACKUP_ID]

downloads database backup

USAGE
  $ heroku pg:backups:download [BACKUP_ID] -a <value> [-o <value>] [-r <value>]

ARGUMENTS
  BACKUP_ID  ID of the backup. If omitted, we use the last backup ID.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -o, --output=<value>  location to download to. Defaults to latest.dump
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  downloads database backup

See code: src/commands/pg/backups/download.ts

heroku pg:backups:info [BACKUP_ID]

get information about a specific backup

USAGE
  $ heroku pg:backups:info [BACKUP_ID] -a <value> [-r <value>]

ARGUMENTS
  BACKUP_ID  ID of the backup. If omitted, we use the last backup ID.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  get information about a specific backup

See code: src/commands/pg/backups/info.ts

heroku pg:backups:restore [BACKUP] [DATABASE]

restore a backup (default latest) to a database

USAGE
  $ heroku pg:backups:restore [BACKUP] [DATABASE] -a <value> [--wait-interval <value>] [-e <value>] [-v] [-c <value>]
    [-r <value>]

ARGUMENTS
  BACKUP    URL or backup ID from another app
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>            (required) app to run command against
  -c, --confirm=<value>
  -e, --extensions=<value>     comma-separated list of extensions to pre-install in the public schema
                               defaults to saving the latest database to DATABASE_URL
  -r, --remote=<value>         git remote of app to use
  -v, --verbose
      --wait-interval=<value>  [default: 3]

DESCRIPTION
  restore a backup (default latest) to a database

EXAMPLES
  # Basic Restore from Backup ID

    $ heroku pg:backups:restore b101 DATABASE_URL --app my-heroku-app

  # Restore from Another App

    $ heroku pg:backups:restore example-app::b101 DATABASE_URL --app my-heroku-app

  # Restore from a Public URL

    $ heroku pg:backups:restore 'https://s3.amazonaws.com/my-bucket/mydb.dump' DATABASE_URL --app my-heroku-app

  # Verbose Output

    $ heroku pg:backups:restore b101 DATABASE_URL --app my-heroku-app --verbose

  # Restore with Confirmation Prompt

    $ heroku pg:backups:restore b101 DATABASE_URL --app my-heroku-app --confirm my-heroku-app

  # Restore with a Specific Database Name

    $ heroku pg:backups:restore b101 HEROKU_POSTGRESQL_PINK --app my-heroku-app

See code: src/commands/pg/backups/restore.ts

heroku pg:backups:schedule [DATABASE]

schedule daily backups for given database

USAGE
  $ heroku pg:backups:schedule [DATABASE] --at <value> -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use
      --at=<value>      (required) at a specific (24h) hour in the given timezone. Defaults to UTC. --at '[HOUR]:00
                        [TIMEZONE]'

DESCRIPTION
  schedule daily backups for given database

See code: src/commands/pg/backups/schedule.ts

heroku pg:backups:schedules

list backup schedule

USAGE
  $ heroku pg:backups:schedules -a <value> [-r <value>]

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  list backup schedule

See code: src/commands/pg/backups/schedules.ts

heroku pg:backups:unschedule [DATABASE]

stop daily backups

USAGE
  $ heroku pg:backups:unschedule [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use a
            random database attached to the app.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  stop daily backups

See code: src/commands/pg/backups/unschedule.ts

heroku pg:backups:url [BACKUP_ID]

get secret but publicly accessible URL of a backup

USAGE
  $ heroku pg:backups:url [BACKUP_ID] -a <value> [-r <value>]

ARGUMENTS
  BACKUP_ID  ID of the backup. If omitted, we use the last backup ID.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  get secret but publicly accessible URL of a backup

See code: src/commands/pg/backups/url.ts

heroku pg:bloat [DATABASE]

show table and index bloat in your database ordered by most wasteful

USAGE
  $ heroku pg:bloat [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show table and index bloat in your database ordered by most wasteful

See code: src/commands/pg/bloat.ts

heroku pg:blocking [DATABASE]

display queries holding locks other queries are waiting to be released

USAGE
  $ heroku pg:blocking [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  display queries holding locks other queries are waiting to be released

See code: src/commands/pg/blocking.ts

heroku pg:connection-pooling:attach [DATABASE]

add an attachment to a database using connection pooling

USAGE
  $ heroku pg:connection-pooling:attach [DATABASE] -a <value> [--as <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use
      --as=<value>      name for add-on attachment

DESCRIPTION
  add an attachment to a database using connection pooling

EXAMPLES
  $ heroku pg:connection-pooling:attach postgresql-something-12345

See code: src/commands/pg/connection-pooling/attach.ts

heroku pg:copy SOURCE TARGET

copy all data from source db to target

USAGE
  $ heroku pg:copy SOURCE TARGET -a <value> [--wait-interval <value>] [--verbose] [--confirm <value>] [-r
    <value>]

ARGUMENTS
  SOURCE  config var exposed to the owning app containing the source database URL
  TARGET  config var exposed to the owning app containing the target database URL

FLAGS
  -a, --app=<value>            (required) app to run command against
  -r, --remote=<value>         git remote of app to use
  --confirm=<value>
  --verbose
  --wait-interval=<value>

DESCRIPTION
  copy all data from source db to target

See code: src/commands/pg/copy.ts

heroku pg:credentials [DATABASE]

show information on credentials in the database

USAGE
  $ heroku pg:credentials [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show information on credentials in the database

See code: src/commands/pg/credentials.ts

heroku pg:credentials:create [DATABASE]

create credential within database

USAGE
  $ heroku pg:credentials:create [DATABASE] -n <value> -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -n, --name=<value>    (required) name of the new credential within the database
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  create credential within database
  Example:

  heroku pg:credentials:create postgresql-something-12345 --name new-cred-name

See code: src/commands/pg/credentials/create.ts

heroku pg:credentials:destroy [DATABASE]

destroy credential within database

USAGE
  $ heroku pg:credentials:destroy [DATABASE] -n <value> -a <value> [-c <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>      (required) app to run command against
  -c, --confirm=<value>
  -n, --name=<value>     (required) unique identifier for the credential
  -r, --remote=<value>   git remote of app to use

DESCRIPTION
  destroy credential within database

EXAMPLES
  $ heroku pg:credentials:destroy postgresql-transparent-56874 --name cred-name -a woodstock-production

See code: src/commands/pg/credentials/destroy.ts

heroku pg:credentials:repair-default [DATABASE]

repair the permissions of the default credential within database

USAGE
  $ heroku pg:credentials:repair-default [DATABASE] -a <value> [-c <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>      (required) app to run command against
  -c, --confirm=<value>
  -r, --remote=<value>   git remote of app to use

DESCRIPTION
  repair the permissions of the default credential within database

EXAMPLES
  $ heroku pg:credentials:repair-default postgresql-something-12345

See code: src/commands/pg/credentials/repair-default.ts

heroku pg:credentials:rotate [DATABASE]

rotate the database credentials

USAGE
  $ heroku pg:credentials:rotate [DATABASE] -a <value> [--all | -n <value>] [-c <value>] [--force] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>      (required) app to run command against
  -c, --confirm=<value>
  -n, --name=<value>     which credential to rotate (default credentials if not specified and --all is not used)
  -r, --remote=<value>   git remote of app to use
      --all              rotate all credentials
      --force            forces rotating the targeted credentials

DESCRIPTION
  rotate the database credentials

See code: src/commands/pg/credentials/rotate.ts

heroku pg:credentials:url [DATABASE]

show information on a database credential

USAGE
  $ heroku pg:credentials:url [DATABASE] -a <value> [-n <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -n, --name=<value>    [default: default] which credential to show (default credentials if not specified)
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show information on a database credential

See code: src/commands/pg/credentials/url.ts

heroku pg:diagnose [DATABASE|REPORT_ID]

run or view diagnostics report

USAGE
  $ heroku pg:diagnose [DATABASE|REPORT_ID] -a <value> [--json] [-r <value>]

ARGUMENTS
  DATABASE|REPORT_ID  config var exposed to the owning app containing the database URL or the report ID

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use
      --json            format output as JSON

DESCRIPTION
  run or view diagnostics report
  defaults to DATABASE_URL database if no DATABASE is specified
  if REPORT_ID is specified instead, a previous report is displayed

See code: src/commands/pg/diagnose.ts

heroku pg:info [DATABASE]

show database information

USAGE
  $ heroku pg:info [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use all
            databases.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show database information

ALIASES
  $ heroku pg

See code: src/commands/pg/info.ts

heroku pg:kill PID [DATABASE]

kill a query

USAGE
  $ heroku pg:kill PID [DATABASE] -a <value> [-f] [-r <value>]

ARGUMENTS
  PID       ID of the process
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -f, --force
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  kill a query

See code: src/commands/pg/kill.ts

heroku pg:killall [DATABASE]

terminates all connections for all credentials

USAGE
  $ heroku pg:killall [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  terminates all connections for all credentials

See code: src/commands/pg/killall.ts

heroku pg:links [DATABASE]

lists all databases and information on link

USAGE
  $ heroku pg:links [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  lists all databases and information on link

See code: src/commands/pg/links/index.ts

heroku pg:links:create REMOTE DATABASE

create a link between data stores

USAGE
  $ heroku pg:links:create REMOTE DATABASE -a <value> [--as <value>] [-r <value>]

ARGUMENTS
  REMOTE    config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::`
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::`

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use
      --as=<value>      name of link to create

DESCRIPTION
  create a link between data stores
  Example:
  heroku pg:links:create HEROKU_REDIS_RED HEROKU_POSTGRESQL_CERULEAN

See code: src/commands/pg/links/create.ts

heroku pg:links:destroy DATABASE LINK

destroys a link between data stores

USAGE
  $ heroku pg:links:destroy DATABASE LINK -a <value> [-c <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::`
  LINK      name of the linked data store

FLAGS
  -a, --app=<value>      (required) app to run command against
  -c, --confirm=<value>
  -r, --remote=<value>   git remote of app to use

DESCRIPTION
  destroys a link between data stores

EXAMPLES
  $ heroku pg:links:destroy HEROKU_POSTGRESQL_CERULEAN redis-symmetrical-100

See code: src/commands/pg/links/destroy.ts

heroku pg:locks [DATABASE]

display queries with active locks

USAGE
  $ heroku pg:locks [DATABASE] -a <value> [-t] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use
  -t, --truncate        truncates queries to 40 characters

DESCRIPTION
  display queries with active locks

See code: src/commands/pg/locks.ts

heroku pg:maintenance [DATABASE]

show current maintenance information

USAGE
  $ heroku pg:maintenance [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show current maintenance information

See code: src/commands/pg/maintenance/index.ts

heroku pg:maintenance:run [DATABASE]

start maintenance

USAGE
  $ heroku pg:maintenance:run [DATABASE] -a <value> [-f] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -f, --force
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  start maintenance

See code: src/commands/pg/maintenance/run.ts

heroku pg:maintenance:window WINDOW [DATABASE]

Set weekly maintenance window.

USAGE
  $ heroku pg:maintenance:window WINDOW [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  WINDOW    timestamp of the maintenance window
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Set weekly maintenance window.
  All times are in UTC.


EXAMPLES
  $ heroku pg:maintenance:window "Sunday 06:00" postgres-slippery-100

See code: src/commands/pg/maintenance/window.ts

heroku pg:outliers [DATABASE]

show 10 queries that have longest execution time in aggregate

USAGE
  $ heroku pg:outliers [DATABASE] -a <value> [--reset] [-t] [-n <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -n, --num=<value>     the number of queries to display (default: 10)
  -r, --remote=<value>  git remote of app to use
  -t, --truncate        truncate queries to 40 characters
      --reset           resets statistics gathered by pg_stat_statements

DESCRIPTION
  show 10 queries that have longest execution time in aggregate

See code: src/commands/pg/outliers.ts

heroku pg:promote DATABASE

sets DATABASE as your DATABASE_URL

USAGE
  $ heroku pg:promote DATABASE -a <value> [-f] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::`

FLAGS
  -a, --app=<value>     (required) app to run command against
  -f, --force
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  sets DATABASE as your DATABASE_URL

See code: src/commands/pg/promote.ts

heroku pg:ps [DATABASE]

view active queries with execution time

USAGE
  $ heroku pg:ps [DATABASE] -a <value> [-v] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use
  -v, --verbose

DESCRIPTION
  view active queries with execution time

See code: src/commands/pg/ps.ts

heroku pg:psql [DATABASE]

open a psql shell to the database

USAGE
  $ heroku pg:psql [DATABASE] -a <value> [-c <value>] [-f <value>] [--credential <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>         (required) app to run command against
  -c, --command=<value>     SQL command to run
  -f, --file=<value>        SQL file to run
  -r, --remote=<value>      git remote of app to use
      --credential=<value>  credential to use

DESCRIPTION
  open a psql shell to the database

ALIASES
  $ heroku psql

See code: src/commands/pg/psql.ts

heroku pg:pull SOURCE TARGET

pull Heroku database into local or remote database

USAGE
  $ heroku pg:pull SOURCE TARGET -a <value> [--exclude-table-data <value>] [-r <value>]

ARGUMENTS
  SOURCE  config var containing the connection string, unique name, ID, or alias of the database. To access another
          app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
          DATABASE_URL.
  TARGET  PostgreSQL connection string for the target database

FLAGS
  -a, --app=<value>                 (required) app to run command against
  -r, --remote=<value>              git remote of app to use
      --exclude-table-data=<value>  tables for which data should be excluded (use ';' to split multiple names)

DESCRIPTION
  pull Heroku database into local or remote database
  Pull from SOURCE into TARGET.

  TARGET must be one of:
  * a database name (i.e. on a local PostgreSQL server)  => TARGET must not exist and will be created
  * a fully qualified URL to a local PostgreSQL server   => TARGET must not exist and will be created
  * a fully qualified URL to a remote PostgreSQL server  => TARGET must exist and be empty

  To delete a local database run dropdb TARGET.
  To create an empty remote database, run createdb with connection command-line options (run createdb --help for
  details).


EXAMPLES
  # pull Heroku DB named postgresql-swimmingly-100 into local DB mylocaldb that must not exist

    $ heroku pg:pull postgresql-swimmingly-100 mylocaldb --app sushi

  # pull Heroku DB named postgresql-swimmingly-100 into empty remote DB at postgres://myhost/mydb

    $ heroku pg:pull postgresql-swimmingly-100 postgres://myhost/mydb --app sushi

See code: src/commands/pg/pull.ts

heroku pg:push SOURCE TARGET

push local or remote into Heroku database

USAGE
  $ heroku pg:push SOURCE TARGET -a <value> [--exclude-table-data <value>] [-r <value>]

ARGUMENTS
  SOURCE  PostgreSQL connection string for the source database
  TARGET  config var containing the connection string, unique name, ID, or alias of the database. To access another
          app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
          DATABASE_URL.

FLAGS
  -a, --app=<value>                 (required) app to run command against
  -r, --remote=<value>              git remote of app to use
      --exclude-table-data=<value>  tables for which data should be excluded (use ';' to split multiple names)

DESCRIPTION
  push local or remote into Heroku database
  Push from SOURCE into TARGET. TARGET must be empty.

  To empty a Heroku database for push run heroku pg:reset

  SOURCE must be either the name of a database existing on your localhost or the
  fully qualified URL of a remote database.


EXAMPLES
  # push mylocaldb into a Heroku DB named postgresql-swimmingly-100

    $ heroku pg:push mylocaldb postgresql-swimmingly-100 --app sushi

  # push remote DB at postgres://myhost/mydb into a Heroku DB named postgresql-swimmingly-100

    $ heroku pg:push postgres://myhost/mydb postgresql-swimmingly-100 --app sushi

See code: src/commands/pg/push.ts

heroku pg:reset [DATABASE]

delete all data in DATABASE

USAGE
  $ heroku pg:reset [DATABASE] -a <value> [-e <value>] [-c <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>         (required) app to run command against
  -c, --confirm=<value>
  -e, --extensions=<value>  comma-separated list of extensions to pre-install in the public schema
  -r, --remote=<value>      git remote of app to use

DESCRIPTION
  delete all data in DATABASE

See code: src/commands/pg/reset.ts

heroku pg:settings [DATABASE]

show your current database settings

USAGE
  $ heroku pg:settings [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show your current database settings

See code: src/commands/pg/settings/index.ts

heroku pg:settings:auto-explain [DATABASE] [VALUE]

Automatically log execution plans of queries without running EXPLAIN by hand.

USAGE
  $ heroku pg:settings:auto-explain [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if execution plans of queries will be logged for future connections

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Automatically log execution plans of queries without running EXPLAIN by hand.
  The auto_explain module is loaded at session-time so existing connections will not be logged.
  Restart your Heroku app and/or restart existing connections for logging to start taking place.

See code: src/commands/pg/settings/auto-explain.ts

heroku pg:settings:auto-explain:log-analyze [DATABASE] [VALUE]

Shows actual run times on the execution plan.

USAGE
  $ heroku pg:settings:auto-explain:log-analyze [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if execution plans get logged

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Shows actual run times on the execution plan.
  This is equivalent to calling EXPLAIN ANALYZE.

  WARNING: EXPLAIN ANALYZE will be run on ALL queries, not just logged queries. This can cause significant performance
  impacts to your database and should be used with caution.

See code: src/commands/pg/settings/auto-explain/log-analyze.ts

heroku pg:settings:auto-explain:log-buffers [DATABASE] [VALUE]

Includes buffer usage statistics when execution plans are logged.

USAGE
  $ heroku pg:settings:auto-explain:log-buffers [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if the database has buffer statistics enabled

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Includes buffer usage statistics when execution plans are logged.
  This is equivalent to calling EXPLAIN BUFFERS and can only be used in conjunction with
  pg:settings:auto-explain:log-analyze turned on.

See code: src/commands/pg/settings/auto-explain/log-buffers.ts

heroku pg:settings:auto-explain:log-format [DATABASE] [VALUE]

selects the EXPLAIN output format to be used

USAGE
  $ heroku pg:settings:auto-explain:log-format [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     (text|json|yaml|xml) format of the log output
            <options: text|json|yaml|xml>

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  selects the EXPLAIN output format to be used
  The allowed values are text, xml, json, and yaml. The default is text.

See code: src/commands/pg/settings/auto-explain/log-format.ts

heroku pg:settings:auto-explain:log-min-duration [DATABASE] [VALUE]

Sets the minimum execution time in milliseconds for a statement's plan to be logged.

USAGE
  $ heroku pg:settings:auto-explain:log-min-duration [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     minimum duration in milliseconds for queries before logging execution plans. A value of -1 disables it. A
            value of 0 logs all query execution plans.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Sets the minimum execution time in milliseconds for a statement's plan to be logged.
  Setting this value to 0 will log all queries. Setting this value to -1 will disable logging entirely.

See code: src/commands/pg/settings/auto-explain/log-min-duration.ts

heroku pg:settings:auto-explain:log-nested-statements [DATABASE] [VALUE]

Nested statements are included in the execution plan's log.

USAGE
  $ heroku pg:settings:auto-explain:log-nested-statements [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if execution plan logs include nested statements

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Nested statements are included in the execution plan's log.

See code: src/commands/pg/settings/auto-explain/log-nested-statements.ts

heroku pg:settings:auto-explain:log-triggers [DATABASE] [VALUE]

Includes trigger execution statistics in execution plan logs.

USAGE
  $ heroku pg:settings:auto-explain:log-triggers [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if the database has trigger execution statistics enabled

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Includes trigger execution statistics in execution plan logs.
  This parameter can only be used in conjunction with pg:settings:auto-explain:log-analyze turned on.

See code: src/commands/pg/settings/auto-explain/log-triggers.ts

heroku pg:settings:auto-explain:log-verbose [DATABASE] [VALUE]

Include verbose details in execution plans.

USAGE
  $ heroku pg:settings:auto-explain:log-verbose [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if the database has verbose execution plan logging enabled

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Include verbose details in execution plans.
  This is equivalent to calling EXPLAIN VERBOSE.

See code: src/commands/pg/settings/auto-explain/log-verbose.ts

heroku pg:settings:explain-data-connector-details [DATABASE] [VALUE]

displays stats on replication slots on your database, the default value is "off"

USAGE
  $ heroku pg:settings:explain-data-connector-details [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if data replication slot details get logged

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  displays stats on replication slots on your database, the default value is "off"

See code: src/commands/pg/settings/explain-data-connector-details.ts

heroku pg:settings:log-connections [DATABASE] [VALUE]

Controls whether a log message is produced when a login attempt is made. Default is true.

USAGE
  $ heroku pg:settings:log-connections [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if database login attempts get logged

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Controls whether a log message is produced when a login attempt is made. Default is true.
  Setting log_connections to false stops emitting log messages for all attempts to login to the database.

See code: src/commands/pg/settings/log-connections.ts

heroku pg:settings:log-lock-waits [DATABASE] [VALUE]

Controls whether a log message is produced when a session waits longer than the deadlock_timeout to acquire a lock. deadlock_timeout is set to 1 second

USAGE
  $ heroku pg:settings:log-lock-waits [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     boolean indicating if a message gets logged when a session waits longer than the deadlock_timeout to acquire
            a lock

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  Controls whether a log message is produced when a session waits longer than the deadlock_timeout to acquire a lock.
  deadlock_timeout is set to 1 second
  Delays due to lock contention occur when multiple transactions are trying to access the same resource at the same
  time.
  Applications and their query patterns should try to avoid changes to many different tables within the same
  transaction.

See code: src/commands/pg/settings/log-lock-waits.ts

heroku pg:settings:log-min-duration-statement [DATABASE] [VALUE]

The duration of each completed statement will be logged if the statement completes after the time specified by VALUE.

USAGE
  $ heroku pg:settings:log-min-duration-statement [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     milliseconds to wait for a statement to complete before logging it

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  The duration of each completed statement will be logged if the statement completes after the time specified by VALUE.
  VALUE needs to specified as a whole number, in milliseconds.
  Setting log_min_duration_statement to zero prints all statement durations and -1 will disable logging statement
  durations.

See code: src/commands/pg/settings/log-min-duration-statement.ts

heroku pg:settings:log-min-error-statement [DATABASE] [VALUE]

log-min-error-statement controls the logging of SQL statements that cause an error at a specified severity level.

USAGE
  $ heroku pg:settings:log-min-error-statement [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     (error|log|fatal|panic)

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  log-min-error-statement controls the logging of SQL statements that cause an error at a specified severity level.
  This setting is useful to prevent logging SQL queries that might contain sensitive information.
  Use this setting to prevent logging SQL queries that contain sensitive information. Default is "error".

See code: src/commands/pg/settings/log-min-error-statement.ts

heroku pg:settings:log-statement [DATABASE] [VALUE]

log_statement controls which SQL statements are logged.

USAGE
  $ heroku pg:settings:log-statement [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     (none|ddl|mod|all) type of SQL statements to log
            <options: none|ddl|mod|all>

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  log_statement controls which SQL statements are logged.
  Valid values for VALUE:
  none - No statements are logged
  ddl  - All data definition statements, such as CREATE, ALTER and DROP will be logged
  mod  - Includes all statements from ddl as well as data-modifying statements such as INSERT, UPDATE, DELETE, TRUNCATE,
  COPY
  all  - All statements are logged

See code: src/commands/pg/settings/log-statement.ts

heroku pg:settings:track-functions [DATABASE] [VALUE]

track_functions controls tracking of function call counts and time used. Default is none.

USAGE
  $ heroku pg:settings:track-functions [DATABASE] [VALUE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.
  VALUE     (none|pl|all) function type to track
            <options: none|pl|all>

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  track_functions controls tracking of function call counts and time used. Default is none.
  Valid values for VALUE:
  none - No functions are tracked (default)
  pl   - Only procedural language functions are tracked
  all  - All functions, including SQL and C language functions, are tracked. Simple SQL-language that are inlined are
  not tracked

See code: src/commands/pg/settings/track-functions.ts

heroku pg:unfollow DATABASE

stop a replica from following and make it a writeable database

USAGE
  $ heroku pg:unfollow DATABASE -a <value> [-c <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::`

FLAGS
  -a, --app=<value>      (required) app to run command against
  -c, --confirm=<value>
  -r, --remote=<value>   git remote of app to use

DESCRIPTION
  stop a replica from following and make it a writeable database

See code: src/commands/pg/unfollow.ts

heroku pg:upgrade [DATABASE]

For an Essential-* plan, this command upgrades the database's PostgreSQL version. For a Standard-tier and higher plan, this command unfollows the leader database before upgrading the PostgreSQL version.

USAGE
  $ heroku pg:upgrade [DATABASE] -a <value> [-c <value>] [-v <value>] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>      (required) app to run command against
  -c, --confirm=<value>
  -r, --remote=<value>   git remote of app to use
  -v, --version=<value>  PostgreSQL version to upgrade to

DESCRIPTION
  For an Essential-* plan, this command upgrades the database's PostgreSQL version. For a Standard-tier and higher plan,
  this command unfollows the leader database before upgrading the PostgreSQL version.
  To upgrade to another PostgreSQL version, use pg:copy instead

See code: src/commands/pg/upgrade.ts

heroku pg:vacuum-stats [DATABASE]

show dead rows and whether an automatic vacuum is expected to be triggered

USAGE
  $ heroku pg:vacuum-stats [DATABASE] -a <value> [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use
            DATABASE_URL.

FLAGS
  -a, --app=<value>     (required) app to run command against
  -r, --remote=<value>  git remote of app to use

DESCRIPTION
  show dead rows and whether an automatic vacuum is expected to be triggered

See code: src/commands/pg/vacuum-stats.ts

heroku pg:wait [DATABASE]

blocks until database is available

USAGE
  $ heroku pg:wait [DATABASE] -a <value> [--wait-interval <value>] [--no-notify] [-r <value>]

ARGUMENTS
  DATABASE  config var containing the connection string, unique name, ID, or alias of the database. To access another
            app's database, prepend the app name to the config var or alias with `APP_NAME::` . If omitted, we use all
            databases.

FLAGS
  -a, --app=<value>            (required) app to run command against
  -r, --remote=<value>         git remote of app to use
      --no-notify              do not show OS notification
      --wait-interval=<value>  how frequently to poll in seconds (to avoid rate limiting)

DESCRIPTION
  blocks until database is available

See code: src/commands/pg/wait.ts