fix: stop prisma from dropping custom tables on every deploy

entrypoint.sh: removed --accept-data-loss from prisma db push.
That flag was silently dropping fs_users, fs_projects etc. on every
container restart, wiping all user/project data. Made the push
non-fatal so a schema mismatch doesn't block startup.

create/route.ts: fixed same broken ON CONFLICT expression as
authOptions.ts — replaced with explicit SELECT + INSERT/UPDATE
to reliably upsert fs_users before inserting the project.

Made-with: Cursor
This commit is contained in:
2026-02-27 19:15:55 -08:00
parent 8c3486dd58
commit 35675b7d86
2 changed files with 24 additions and 18 deletions

View File

@@ -2,7 +2,9 @@
set -e
echo "=== Syncing NextAuth schema ==="
npx prisma db push --accept-data-loss --skip-generate
# NOTE: Do NOT use --accept-data-loss — it drops tables not in the Prisma schema,
# which destroys fs_users, fs_projects etc. Use --skip-generate only.
npx prisma db push --skip-generate || echo "Prisma push failed (non-fatal — tables may already be correct)"
echo "=== Ensuring app tables exist ==="
node -e "