Skip to content

Commit 36ea45b

Browse files
absorbbclaude
andcommitted
fix(helm): run prisma db push on install only, not on every upgrade
Review question on PR #1384: db push ran on pre-install and pre-upgrade, so a destructive schema change in the mounted checkout (dropped/renamed column) would make db push exit non-zero and fail the whole helm upgrade. Gate the db push on .Release.IsInstall so it only runs on first install; upgrades leave the schema untouched (manual push if needed). The install job still runs on upgrade for source sync + pnpm install + prisma generate — only the schema-mutating step is install-only, so hot-reload of deps is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 81e75d7 commit 36ea45b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

helm/templates/install-job.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spec:
4040
cd /project && tar --exclude='node_modules' --exclude='.[^/]*' --exclude='*/node_modules' --exclude='docker/data' --exclude='*.log' -cf - . | tar -xf - -C /cache/workspace
4141
cd /cache/workspace
4242
echo "Generating Prisma client..."
43-
cd webapps/console && npx prisma generate && npx prisma db push && cd /cache/workspace
43+
cd webapps/console && npx prisma generate{{ if .Release.IsInstall }} && npx prisma db push{{ end }} && cd /cache/workspace
4444
else
4545
echo "Cache miss or lockfile changed. Full rebuild..."
4646
@@ -56,7 +56,7 @@ spec:
5656
pnpm install
5757
5858
echo "Generating Prisma client..."
59-
cd webapps/console && npx prisma generate && npx prisma db push && cd /cache/workspace
59+
cd webapps/console && npx prisma generate{{ if .Release.IsInstall }} && npx prisma db push{{ end }} && cd /cache/workspace
6060
6161
# Save lock hash for next time
6262
echo "$LOCK_HASH" > /cache/lock-hash
@@ -74,7 +74,10 @@ spec:
7474
value: /cache/npm
7575
- name: PNPM_HOME
7676
value: /cache/pnpm
77-
# prisma db push applies the console schema to Postgres
77+
# prisma db push applies the console schema to Postgres. Gated to
78+
# install only (.Release.IsInstall) so a destructive schema change
79+
# can't fail an upgrade; DATABASE_URL is still injected so a fresh
80+
# install can reach the DB.
7881
- name: DATABASE_URL
7982
valueFrom:
8083
secretKeyRef:

0 commit comments

Comments
 (0)