ci: use prisma db execute (no psql dep); baseline migrations after push
CI / Architecture Guardrails (push) Successful in 2m54s
CI / Typecheck (push) Successful in 3m38s
CI / Lint (push) Successful in 3m56s
CI / Assistant Split Regression (push) Successful in 4m17s
CI / Unit Tests (push) Successful in 6m32s
CI / Build (push) Successful in 6m8s
CI / E2E Tests (push) Failing after 4m37s
CI / Fresh-Linux Docker Deploy (push) Failing after 6m7s
CI / Release Images (push) Has been skipped

- e2e: switch schema reset + sanity check from psql (not installed in
  act_runner's catthehacker/ubuntu image) to `prisma db execute --stdin`
  which is already a dev dep.
- docker-deploy: after `db push` the schema matches schema.prisma but
  _prisma_migrations is empty, so the follow-up `migrate deploy` fails
  with P3005. Baseline each migration directory as applied via
  `prisma migrate resolve --applied` before deploy; the migrations
  themselves are idempotent supplements, so marking-as-applied is safe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-12 23:01:51 +02:00
parent 8be01fe6aa
commit 0b2d263d30
2 changed files with 21 additions and 9 deletions
+11
View File
@@ -28,6 +28,17 @@ pnpm --filter @capakraken/db db:generate
# migration references "users" before it exists.
pnpm --filter @capakraken/db exec prisma db push --schema ./prisma/schema.prisma --accept-data-loss --skip-generate
# After db push the schema matches schema.prisma exactly, but the
# _prisma_migrations table is empty, which makes `migrate deploy` fail
# with P3005 ("schema is not empty"). Baseline each migration as applied
# so deploy sees a clean slate; the migrations themselves are idempotent
# supplements (IF NOT EXISTS guards), so marking-as-applied is safe.
for m in packages/db/prisma/migrations/*/; do
name=$(basename "$m")
pnpm --filter @capakraken/db exec prisma migrate resolve \
--applied "$name" --schema ./prisma/schema.prisma || true
done
# Run pending migrations so a fresh checkout picks up incremental additions
pnpm --filter @capakraken/db db:migrate:deploy