Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add custom ORM guide to branching docs (#34454)

Han Qiao462e0fce58e5
diff --git a/apps/docs/content/guides/deployment/branching.mdx b/apps/docs/content/guides/deployment/branching.mdx
index 3c0a4339d33..02b827b25b7 100644
--- a/apps/docs/content/guides/deployment/branching.mdx
+++ b/apps/docs/content/guides/deployment/branching.mdx
@@ -468,6 +468,49 @@ Migrations are run in sequential order. Each migration builds upon the previous
The preview branch has a record of which migrations have been applied, and only applies new migrations for each commit. This can create an issue when rolling back migrations.
+### Using ORM or custom seed scripts
+
+If you want to use your own ORM for managing migrations and seed scripts, you will need to run them in GitHub Actions after the preview branch is ready. The branch credentials can be fetched using the following example GHA workflow.
+
+```yaml
+on:
+ pull_request:
+ types:
+ - opened
+ - reopened
+ - synchronize
+ branches:
+ - main
+ paths:
+ - 'supabase/**'
+
+jobs:
+ wait:
+ runs-on: ubuntu-latest
+ outputs:
+ status: ${{ steps.check.outputs.conclusion }}
+ steps:
+ - uses: fountainhead/[email protected]
+ id: check
+ with:
+ checkName: Supabase Preview
+ ref: ${{ github.event.pull_request.head.sha }}
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ migrate:
+ needs:
+ - wait
+ if: ${{ needs.wait.outputs.status == 'success' }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: supabase/setup-cli@v1
+ with:
+ version: latest
+ - run: supabase --experimental branches get "$GITHUB_HEAD_REF" -o env >> $GITHUB_ENV
+ - name: Custom ORM migration
+ run: psql "$POSTGRES_URL_NON_POOLING" -c 'select 1'
+```
+
## Branch configuration with remotes
When Branching is enabled, your `config.toml` settings automatically sync to all ephemeral branches through a one-to-one mapping between your Git and Supabase branches.