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 [テーブル名];
テーブル構造を取得