Backup & Restore

Hello In "self hosting" mode, what is the best way to backup/restore Twenty database? Using API or pg_dump? How?
3 Replies
charles
charles10mo ago
I would say pg_dump is the way to go right now 🙂
greg [iero]
greg [iero]OP10mo ago
Merci @charles What is the name of the database? "default"? I used psql --username=twenty command to connect to the DB but I'm not sure it is the right way
% psql -U twenty -h localhost -p 5432 default
psql (14.10 (Homebrew), server 15.5 (Homebrew))
WARNING: psql major version 14, server major version 15.
Some psql features might not work.
Type "help" for help.

default=# \d
Did not find any relations.
default=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+---------+-------+-------------------
default | iero | UTF8 | C | C |
postgres | iero | UTF8 | C | C |
template0 | iero | UTF8 | C | C | =c/iero +
| | | | | iero=CTc/iero
template1 | iero | UTF8 | C | C | =c/iero +
| | | | | iero=CTc/iero
test | iero | UTF8 | C | C |
(5 rows)
% psql -U twenty -h localhost -p 5432 default
psql (14.10 (Homebrew), server 15.5 (Homebrew))
WARNING: psql major version 14, server major version 15.
Some psql features might not work.
Type "help" for help.

default=# \d
Did not find any relations.
default=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+---------+-------+-------------------
default | iero | UTF8 | C | C |
postgres | iero | UTF8 | C | C |
template0 | iero | UTF8 | C | C | =c/iero +
| | | | | iero=CTc/iero
template1 | iero | UTF8 | C | C | =c/iero +
| | | | | iero=CTc/iero
test | iero | UTF8 | C | C |
(5 rows)
Ok, found it. It is in default and "workspace_2". So I will do pg_dump -U twenty -h localhost -p 5432 -F c default > db1.tar
charles
charles10mo ago
yes, default is the right one! you'll find your data in your workspace_xxxx postgres schema but make sure to also dump core and metadata schemas
Want results from more Discord servers?
Add your server