8
6

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 5 years have passed since last update.

herokuのdbを操作する

8
Last updated at Posted at 2013-12-10

dbへアクセス

$ heroku pg:psql

SHOW DATABASES

=> \d

SELECT * FROM foos

=> SELECT * FROM foos;
 # (MySQLと一緒)

実際にログインしたところ

$ heroku pg:psql
---> Connecting to HEROKU_POSTGRESQL_CRIMSON_URL (DATABASE_URL)
psql (9.1.5, server 9.3.2)
WARNING: psql version 9.1, server version 9.3.
         Some psql features might not work.
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.


da41a3g4hv191h=> \d

                   List of relations
 Schema |       Name        |   Type   |     Owner
--------+-------------------+----------+----------------
 public | calls             | table    | iqpuweabqkjiie
 public | calls_id_seq      | sequence | iqpuweabqkjiie
 public | schema_migrations | table    | iqpuweabqkjiie
(3 rows)

da41a3g4hv191h=> select * from calls;

 id |                                                                                          message                                                                                           |    to     |         created_at         |         updated_at
----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------------------------+----------------------------
  1 | oh                                                                                                                                                                     |           | 2013-12-09 15:34:05.42589  | 2013-12-09 15:34:05.42589
  2 | yeah                                                                                                                                                         |           | 2013-12-09 15:36:23.067689 | 2013-12-09 15:36:23.067689
  3 | fugafuga                                                                                                                                                         |           | 2013-12-09 15:36:47.679216 | 2013-12-09 15:36:47.679216

とりあえずこれだけ。

8
6
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
8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?