Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"private": true,
"scripts": {
"dev": "bun run db:generate && next dev",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 · HIGH · Build now applies production migrations (side effects during build)

apps/web/package.json changes build to run bun run db:migrate (Prisma migrate deploy). This introduces schema/data mutation as part of the build step, which can unexpectedly affect CI/local/dev environments and expand blast radius. Suggested fix: move migrations to a deployment-specific step (or gate with an env var) instead of running during build.

"build": "bun run db:generate && next build --webpack",
"build": "bun run db:generate && bun run db:migrate && next build --webpack",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Build requires database access

If a build environment has no reachable PostgreSQL database, db:migrate fails and next build never runs. A database outage or an isolated build can therefore prevent the web bundle from being produced, even when the build itself does not need to deploy migrations.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Cached builds skip migrations

The root build uses Turborepo's cacheable build task. If the database is restored to an older schema while the source and DATABASE_URL remain unchanged, a cache hit restores the web build without running db:migrate. The deployed app can then expect tables or columns that were never migrated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Preview builds deploy migrations

If a preview or branch build shares the production DATABASE_URL, this script applies its pending migrations to the live database before that version of the app is released. The migration history includes a data backfill and column drops, so an ordinary non-production build could change production data or schema unexpectedly.

"postinstall": "bun run db:generate",
"start": "next start",
"lint": "eslint",
"typecheck": "tsc --noEmit",
"db:generate": "prisma generate --schema ../../packages/db/prisma/schema.prisma"
"db:generate": "prisma generate --schema ../../packages/db/prisma/schema.prisma",
"db:migrate": "prisma migrate deploy --config ../../packages/db/prisma.config.ts"
},
"dependencies": {
"@ai-sdk/anthropic": "^4.0.49",
Expand Down
Loading