Run prisma migrate deploy during deploy
This commit is contained in:
parent
c95f6ce0be
commit
16fa9bb051
2 changed files with 8 additions and 0 deletions
|
|
@ -24,3 +24,4 @@ Deploy commands
|
||||||
Notes
|
Notes
|
||||||
- Ensure `deploy/.last-image` exists (run `deploy/build.sh` first).
|
- Ensure `deploy/.last-image` exists (run `deploy/build.sh` first).
|
||||||
- `AUTH_SECRET`/`DATABASE_URL` should be in your env or loaded via `scripts/load-secrets.sh`.
|
- `AUTH_SECRET`/`DATABASE_URL` should be in your env or loaded via `scripts/load-secrets.sh`.
|
||||||
|
- `deploy/deploy.sh` now runs `prisma migrate deploy` automatically when `DATABASE_URL` is set (recommended for test/staging/prod).
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,13 @@ APP_VERSION="${APP_VERSION:-$(echo \"$IMAGE\" | awk -F: '{print $NF}')}"
|
||||||
|
|
||||||
export K8S_NAMESPACE APP_HOST API_HOST NEXT_PUBLIC_SITE_URL NEXT_PUBLIC_API_BASE APP_ENV CLUSTER_ISSUER INGRESS_CLASS APP_REPLICAS K8S_IMAGE APP_VERSION
|
export K8S_NAMESPACE APP_HOST API_HOST NEXT_PUBLIC_SITE_URL NEXT_PUBLIC_API_BASE APP_ENV CLUSTER_ISSUER INGRESS_CLASS APP_REPLICAS K8S_IMAGE APP_VERSION
|
||||||
|
|
||||||
|
if [[ -n "${DATABASE_URL:-}" ]]; then
|
||||||
|
echo "Running Prisma migrations for APP_ENV=$APP_ENV"
|
||||||
|
npx prisma migrate deploy
|
||||||
|
else
|
||||||
|
echo "DATABASE_URL not set; skipping Prisma migrations" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
TMP_MANIFEST=$(mktemp)
|
TMP_MANIFEST=$(mktemp)
|
||||||
envsubst < k8s/app.yaml > "$TMP_MANIFEST"
|
envsubst < k8s/app.yaml > "$TMP_MANIFEST"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue