The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(docs): update notes on migrating project (#20767)
Han Qiao392e4416caab
diff --git a/apps/docs/pages/guides/platform/migrating-and-upgrading-projects.mdx b/apps/docs/pages/guides/platform/migrating-and-upgrading-projects.mdxindex 763a84b2ea2..805272127b2 100644--- a/apps/docs/pages/guides/platform/migrating-and-upgrading-projects.mdx+++ b/apps/docs/pages/guides/platform/migrating-and-upgrading-projects.mdx@@ -119,7 +119,7 @@ Migrating projects can be achieved using the Supabase CLI. This is particularly### Before you begin- Install [Postgres](https://www.postgresql.org/download/) so you can run `psql` and `pg_dump`.-- Install [Supabase CLI](/docs/guides/cli#installation).+- Install the latest version of [Supabase CLI](/docs/guides/cli#installation).- Create a new [Supabase project](https://supabase.com/dashboard).- Install [Docker Desktop](https://www.docker.com) for your platform.- Set environment variables for the old project's database URL as `$OLD_DB_URL` and the new project's as `$NEW_DB_URL`.@@ -139,7 +139,6 @@ Note that this direct connection string to the database uses IPv6. If your netwosupabase db dump --db-url "$OLD_DB_URL" -f roles.sql --role-onlysupabase db dump --db-url "$OLD_DB_URL" -f schema.sqlsupabase db dump --db-url "$OLD_DB_URL" -f data.sql --use-copy --data-only-supabase db dump --db-url "$OLD_DB_URL" -f history.sql --use-copy --data-only --schema supabase_migrations```### Restore to your new project@@ -184,6 +183,21 @@ Troubleshooting notes:- If you have created any [custom roles](https://supabase.com/dashboard/project/_/database/roles) with `login` attribute, you have to manually set their passwords in the new project.- If you run into any permission errors related to `supabase_admin` during restore, edit the `schema.sql` file and comment out any lines containing `ALTER ... OWNER TO "supabase_admin"`.+### Preserving migration history++If you were using Supabase CLI for managing migrations on your old database and would like to preserve the migration history in your newly restored project, you need to insert the migration records separately using the following commands.++```bash+supabase db dump --db-url "$OLD_DB_URL" -f history_schema.sql --schema supabase_migrations+supabase db dump --db-url "$OLD_DB_URL" -f history_data.sql --use-copy --data-only --schema supabase_migrations+psql \+ --single-transaction \+ --variable ON_ERROR_STOP=1 \+ --file history_schema.sql \+ --file history_data.sql \+ --dbname "$NEW_DB_URL"+```+### Schema changes to `auth` and `storage`If you have modified the `auth` and `storage` schemas in your old project, such as adding triggers or RLS policies, you have to restore them separately. The Supabase CLI can help you diff the changes to these schemas using the following commands.