cli
cli copied to clipboard
data missing on supabase db dump
Describe the bug
If I run the command supabase db dump -f dump.sql, only the schema will be dumped. How can I do a full dump including the data?
$ supabase db dump -f dump.sql
Dumping schemas from remote database...
Dumped schema to dump.sql.
To Reproduce
- Link your project with
supabase link - Run
supabase db dump -f dump.sql
Expected behavior The dump includes the data
System information
- Version of OS: Ubuntu 22.04.4 LTS in WSL2 (Windows 11)
- Version of CLI: 1.187.10
- Version of Docker: 24.0.7, build afdd53b
I've seen that there is the parameter --data-only. The command results into a warning that suggests a full dump. How can I run a full dump?
$ supabase db dump -f dump.sql --data-only
Dumping data from remote database...
pg_dump: warning: there are circular foreign-key constraints on this table:
pg_dump: detail: key
pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem.
Dumped schema to dump.sql.
It's more likely that you don't need to run a full dump. You can try starting your db locally from dump files. If no errors are thrown, then everything is fine.
Here are the commands to do that
supabase db dump | supabase migration new remote_schema
supabase db dump --data-only -f seed.sql
supabase db start