-
Notifications
You must be signed in to change notification settings - Fork 0
/
postgres.txt
50 lines (47 loc) · 1.21 KB
/
postgres.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
HEROKU:
VIEW DATABASE INFO:
- heroku pg:info
SEE DATABASE URL
- heroku pg:credentials DATABASE
POSTGRESQL:
LOGGING IN:
- heroku pg:psql
CREATE INDEX:
- CREATE [UNIQUE]? INDEX <name> ON <table> (column);
DROP INDEX:
- DROP INDEX <name>;
SHOW TABLES:
- \d
SHOW COLUMNS:
- \d <table name>
DESCRIBE TABLE:
- \d+ <table name>
POSTGRES BACKUPS: (Dev plans keep up to 7 manual backups)
ADDING ADDON:
- heroku addons:add pgbackups
DEFAULT BACKUP:
- heroku pgbackups:capture (HEROKU DB NAME)? [--expire]
LIST BACKUPS:
- heroku pgbackups
DOWNLOADING A BACKUP:
- heroku pgbackups:url (b### to specify version)
DELETING:
- heroku pgbackups:destroy b###
RESTORING:
- heroku pgbackups:restore HEROKU_POSTGRES_DB b###
REMOVING THE ADDON:
- heroku addons:remove pgbackups (ALL BACKUPS ARE DESTROYED)
ALEMBIC:
CREATE A REVISION:
- alembic revision -m "comment here"
- alembic revision --autogenerate -m "comment here"
UPGRADE:
- alembic upgrade head (+2)
- alembic upgrade <revision>
DOWNGRADE:
- alembic downgrade base (reset)
- alembic downgrade (-1)
VIEW CURRENT:
- alembic current
VIEW HISTORY:
- alembic history