Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

[DX] Figure out how to make a local backup #240

Open
ykdojo opened this issue Oct 2, 2022 · 9 comments
Open

[DX] Figure out how to make a local backup #240

ykdojo opened this issue Oct 2, 2022 · 9 comments
Assignees
Labels
dx New developer experience related feature or request

Comments

@ykdojo
Copy link
Collaborator

ykdojo commented Oct 2, 2022

Description

Now that we have more questions in our production database (ref: #232), we should figure out how to make a local backup.

Current plan: follow this.

@ykdojo ykdojo added the dx New developer experience related feature or request label Oct 2, 2022
@ykdojo ykdojo self-assigned this Oct 2, 2022
@aakashraj01
Copy link

Hey @ykdojo Can you assign me this issue under Hacktoberfest 2022 label? I would love to contribute in this issue

@ykdojo
Copy link
Collaborator Author

ykdojo commented Oct 3, 2022

Update:

I tried the methods described in the blog post, but it didn't quite work - I got a connection error.

I used pgAdmin and it seems like I was able to get a backup, but I had trouble restoring the production/dev databases from the backups, too.

@aakashraj01 aakashraj01 removed their assignment Oct 4, 2022
@aakashraj01
Copy link

Update:

I tried the methods described in the blog post, but it didn't quite work - I got a connection error.

I used pgAdmin and it seems like I was able to get a backup, but I had trouble restoring the production/dev databases from the backups, too.

I also tried but error is coming always.

@CerealPlayer
Copy link
Contributor

Hey @ykdojo I managed to make this work on my copy of defaang db in Supa bootstraped with supabase.sql file.

Instead of using the connection string (which errors because it needs a tls certificate, it could still be done), I used the pooling connection string, which is below the connection string in the settings panel. Pooling must be enabled.

poolingconnstring

Worth noting I run pg_dump in a Postgres docker container, much easier to setup than installing Postgres locally.

@ykdojo
Copy link
Collaborator Author

ykdojo commented Oct 11, 2022

@CerealPlayer sounds good. Were you able to restore a DB from that?

@CerealPlayer
Copy link
Contributor

Yes! it generated a dump.sql with all the info I had stored in my copy of defaang.

@ykdojo
Copy link
Collaborator Author

ykdojo commented Oct 11, 2022

How did you upload it back to Supabase? That was another part I had trouble with.

@CerealPlayer
Copy link
Contributor

This helps. The best approach would be to pg_dump certain tables that we know are critical and then pg_restore only those, since a full pg_dump would backup all schemas, and supabase doesn't support creating an empty database yet.

@ykdojo
Copy link
Collaborator Author

ykdojo commented Oct 12, 2022

The best approach would be to pg_dump certain tables that we know are critical and then pg_restore only those, since a full pg_dump would backup all schemas, and supabase doesn't support creating an empty database yet.

Got it. Backing up a database and restoring it seems like a pretty basic feature to have, though (I remember I had it in Heroku when I was using it).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dx New developer experience related feature or request
Projects
None yet
Development

No branches or pull requests

3 participants