0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

HerokuのPostgresにCLI接続

Last updated at Posted at 2022-07-31
heroku pg:psql -a {アプリ名}

これでDBを直接いじることができる


heroku pg --help

  pg:backups             list database backups
  pg:bloat               show table and index bloat in your database ordered by most wasteful
  pg:blocking            display queries holding locks other queries are waiting to be released
  pg:connection-pooling  add an attachment to a database using connection pooling
  pg:copy                copy all data from source db to target
  pg:credentials         show information on credentials in the database
  pg:diagnose            run or view diagnostics report
  pg:info                show database information
  pg:kill                kill a query
  pg:killall             terminates all connections for all credentials
  pg:links               lists all databases and information on link
  pg:locks               display queries with active locks
  pg:maintenance         show current maintenance information
  pg:outliers            show 10 queries that have longest execution time in aggregate
  pg:promote             sets DATABASE as your DATABASE_URL
  pg:ps                  view active queries with execution time
  pg:psql                open a psql shell to the database
  pg:pull                pull Heroku database into local or remote database
  pg:push                push local or remote into Heroku database
  pg:reset               delete all data in DATABASE
  pg:settings            show your current database settings
  pg:unfollow            stop a replica from following and make it a writeable database
  pg:upgrade             unfollow a database and upgrade it to the latest stable PostgreSQL version
  pg:vacuum-stats        show dead rows and whether an automatic vacuum is expected to be triggered
  pg:wait                blocks until database is available
\dt;

使用可能なテーブル一覧を取得

\d [テーブル名];

テーブル構造を取得

PostgreSQLの基本的なコマンド

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?