Skip to content

Transferring from platform to self-hosted Supabase

有关如何将数据库从 Supabase 平台恢复到 自托管 Supabase 实例的详细分步指南,请参阅 将平台项目恢复到自托管

🌐 For a detailed, step-by-step guide on restoring your database from the Supabase platform to a self-hosted Supabase instance, see Restore a Platform Project to Self-Hosted.

快速参考 #

🌐 Quick reference

备份你的云数据库:

🌐 Back up your cloud database:

1
supabase db dump --db-url "[CONNECTION_STRING]" -f roles.sql --role-only
1
supabase db dump --db-url "[CONNECTION_STRING]" -f schema.sql
1
supabase db dump --db-url "[CONNECTION_STRING]" -f data.sql --use-copy --data-only

恢复到你自己的自托管实例:

🌐 Restore to your self-hosted instance:

1
psql \
2
--single-transaction \
3
--variable ON_ERROR_STOP=1 \
4
--file roles.sql \
5
--file schema.sql \
6
--command 'SET session_replication_role = replica' \
7
--file data.sql \
8
--dbname "postgres://postgres.your-tenant-id:[POSTGRES_PASSWORD]@[your-domain]:5432/postgres"