Skip to content
/ scl Public

Commit cb4f608

Browse files
committed
update supabase
1 parent c985759 commit cb4f608

6 files changed

Lines changed: 38 additions & 2 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Supabase DB Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'supabase/migrations/**'
9+
- 'database/**'
10+
- '.github/workflows/supabase-db-push.yml'
11+
workflow_dispatch:
12+
13+
jobs:
14+
push-migrations:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: Push Supabase migrations
21+
env:
22+
SUPABASE_DB_URL: ${{ secrets.SUPABASE_DB_URL }}
23+
run: npx -y supabase@latest db push --db-url "$SUPABASE_DB_URL"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ npm install
7272
- [database/003_delete_own_roadmap_account.sql](database/003_delete_own_roadmap_account.sql)
7373

7474
For automatic deployment with Supabase CLI, use the mirrored migrations in [supabase/migrations](supabase/migrations).
75+
Automated pushes run from [\.github/workflows/supabase-db-push.yml](.github/workflows/supabase-db-push.yml) when migration files change on `main`.
7576

7677
4. Build and deploy:
7778

assets/js/roadmap-auth.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,11 @@
524524
var removalResult = await client.rpc("delete_current_user_account");
525525
if (removalResult.error) {
526526
setSubmitting(false);
527+
if ((removalResult.error.message || "").toLowerCase().indexOf("schema cache") !== -1) {
528+
setStatus(status, "Supabase has not picked up the delete migration yet. Check that the GitHub Action ran, the SUPABASE_DB_URL secret is set, and the migration exists in supabase/migrations.", "error");
529+
return;
530+
}
531+
527532
setStatus(status, removalResult.error.message, "error");
528533
return;
529534
}

database/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Supabase SQL Setup
22

33
These files are the human-readable source copies for the schema.
4-
For automatic Supabase application, use the mirrored files under `supabase/migrations/`.
4+
For automatic Supabase application, use the mirrored files under `supabase/migrations/` and the GitHub Action in [\.github/workflows/supabase-db-push.yml](../.github/workflows/supabase-db-push.yml).
55

66
Run these scripts in Supabase SQL Editor in order:
77

@@ -15,3 +15,6 @@ Notes:
1515
- Policies are included for authenticated access.
1616
- A trigger keeps `public.user_profiles` in sync when a new auth user is created.
1717
- The delete-account function removes the auth user and lets cascading foreign keys clear related roadmap data.
18+
19+
Automation note:
20+
- Set the `SUPABASE_DB_URL` secret in GitHub so the workflow can push migrations on each main-branch check-in.

manual/ARCHITECTURE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ Auto-run Supabase migration mirror:
8080
- `supabase/migrations/20260718000200_roadmap_progress.sql`
8181
- `supabase/migrations/20260718000300_delete_own_roadmap_account.sql`
8282

83+
Deployment automation:
84+
- GitHub Action: `.github/workflows/supabase-db-push.yml`
85+
- Required secret: `SUPABASE_DB_URL`
86+
8387
Run SQL scripts in order using Supabase SQL Editor before enabling connected roadmap mode.
8488

8589
Supabase Auth must allow the password recovery redirect URL:

roadmap/unregister.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h1 class="chalk-text">Remove Your Progress</h1>
2727
<section class="container my-4" aria-label="Remove roadmap account">
2828
<div class="card-slate p-4">
2929
<div class="alert alert-danger mb-3">
30-
This action permanently removes your roadmap account, profile data, and stored progress. It cannot be recovered.
30+
This action permanently removes your roadmap account, profile data, and stored progress. It cannot be recovered. Please type your password to confirm your removal action.
3131
</div>
3232

3333
<form id="roadmap-unregister-form">

0 commit comments

Comments
 (0)