podzooka

Recovering what you lost (Supabase CLI vs apps/web)

What Supabase can bring back

Your hosted Supabase project still holds:

The Supabase CLI can download that schema into this repo as SQL migrations:

cd /path/to/podzooka-boom

# 1) Log in (opens browser) — one-time per machine
npx supabase login

# 2) Link this folder to your cloud project
#    Project ref: Dashboard → Project Settings → General → "Reference ID"
#    (also visible in the project URL: https://supabase.com/dashboard/project/<ref>)
npx supabase link --project-ref YOUR_PROJECT_REF
# If prompted, use the database password from: Project Settings → Database

# 3) Pull the live schema into a new migration file under supabase/migrations/
npm run db:pull
# (same as: npx supabase db pull remote_schema)

After db pull, open supabase/migrations/*_remote_schema.sql — that file is your recovered database definition you can commit, review, and reuse (e.g. to bootstrap another environment with supabase db push on a fresh project, or as documentation).

Optional: regenerate TypeScript types from the linked project

npx supabase gen types typescript --linked > packages/shared/src/database.types.ts

(Adjust the output path to match how you want to consume types.)


What Supabase cannot recover

Deleting apps/web removed Next.js source: app/, app/api/**, server components, etc. That code was never stored inside Supabase—only your data and DB schema live there.

To get API/UI code back you need one of:

What you still have in this repo as a partial stand-in for /api/* when the web app is gone:


Quick reference

Goal Command / action
Link repo → cloud project npx supabase link --project-ref <ref>
Dump remote schema to SQL npx supabase db pull <migration_name>
Types from linked project npx supabase gen types typescript --linked
Local Postgres + migrations npx supabase start (Docker required)

If db pull fails: “migration history does not match”

Your remote DB was migrated with SQL files that are not in this workspace (e.g. after removing apps/web). Until those files are restored, use a schema dump instead of pull:

npm run db:dump

Writes supabase/schema.remote.sql from the linked project (requires npm run db:link first).

Optional: supabase migration repair ... can reconcile history on the server—only use if you know what you’re doing.

Files in this repo

Do not commit database passwords or service role keys; keep those in .env / CI secrets only.

Note: Linking with the CLI does not change Expo or apps/mobile/.env.local. The app still needs correct EXPO_PUBLIC_* vars and a running /api server (see docs/MOBILE_SUPABASE_CONNECT.md).