Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,32 @@ Reference: https://supabase.com/docs/guides/cli/local-development
- Reset database to apply `/supabase/migrations`: `npx supabase db reset`
- Copy `/env.dist` to `/.env.local`, replace in `API URL` and `anon key`
- Start edge functions service: `npx supabase functions serve --env-file ./supabase/env.local.dist`
- Start app in second terminal: `npm run dev`
- Start app in second terminal: `npm run dev`
## Supabase manual push

Follow these steps when you need to apply changes to the hosted database without the CI pipeline.

1. Start the local stack with `npx supabase start` (uses Docker Compose).
2. Apply migrations locally and verify everything still works:
```bash
npx supabase db reset
npm run build
```
3. Export a backup of the remote database before modifying it:
```bash
npx supabase db dump --db-url <remote-db-url> > supabase/backup.sql
```
4. Generate a new migration from your local schema:
```bash
npx supabase db diff --schema public --file supabase/migrations/$(date +%Y%m%d%H%M%S)_manual.sql
```
5. Test the migration locally with `npx supabase db reset`.
6. Push the migration to production:
```bash
npx supabase db push --db-url <remote-db-url>
```
7. Optionally pull down the remote schema afterwards so local and remote stay in sync:
```bash
npx supabase db pull --db-url <remote-db-url>
```