You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored and
Edwin Chan
committed
docs: update SETUP.md for db push flow + new asset table
- Replace `prisma migrate deploy` with the `prisma db push` flow this
repo actually uses (no migrations directory exists)
- Add a "Deploying this pull" callout for ProblemSetAsset: run db push
then prisma generate then pm2 reload, with a verification psql
- Note the pm2-stale-client failure mode (today's API 500 was caused
by reloading code without regenerating the Prisma client) and put
the fix in §10 troubleshooting
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
If the database is fresh and there are no migration files yet, use `npx prisma db push` once to create the schema, then commit a baseline migration on your dev box later.
64
+
This repo uses `prisma db push` (not `prisma migrate`). See §7 for why
`db push` is idempotent — running it when nothing changed is a no-op.
198
+
It does **not** drop columns unless you explicitly accept the prompt,
199
+
so it's safe for additive changes (new tables, new optional columns,
200
+
new indexes). Back up first (`pg_dump`, see §8) if a change is
201
+
destructive or you're not sure.
202
+
203
+
If you ever need to switch this repo to migration files, run
204
+
`prisma migrate dev --name baseline` on dev *once* to capture the
205
+
current state, commit `prisma/migrations/`, and from then on use
206
+
`prisma migrate deploy` on the VPS.
207
+
185
208
## 8. Backups
186
209
187
210
```bash
@@ -208,4 +231,4 @@ Cron it:
208
231
-**Build OOM on VPS** — small VPS? `NODE_OPTIONS="--max-old-space-size=2048" npm run build`.
209
232
-**Prisma can't connect** — verify `DATABASE_URL`, run `psql "$DATABASE_URL" -c '\dt'` to confirm credentials.
210
233
-**Google sign-in loops** — `NEXTAUTH_URL` must be your public HTTPS URL exactly, and the OAuth redirect URI in Google Cloud must include `https://your.domain.example/api/auth/callback/google`.
211
-
-**Schema out of sync** — `npx prisma migrate status` to see what's pending.
234
+
-**Schema out of sync** — re-run `npx prisma db push` then `pm2 reload dbsmo`. If `pm2 logs --err` shows "Unknown field" or "Unknown model", the running pm2 process is loading a stale `@prisma/client`. Run `npx prisma generate` then `pm2 reload dbsmo`.
0 commit comments