Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

737
Views
Should I run prisma migrate on every app start?

I'm deploying a NodeJS project that uses PostgreSQL with Prisma to Kubernetes. I created the Dockerfile and I'm building the docker image to Docker Hub:

FROM node:lts-slim

WORKDIR /app

# Add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
ENV NODE_ENV=production

RUN apt-get update

# Install Chromium
RUN apt-get install chromium -y

# Install yarn
RUN apt-get install yarn -y

COPY package.json /app/package.json
RUN yarn install --silent

# Add app
COPY . /app

# Generate prisma
RUN yarn run generate

# Build the app
RUN yarn build

EXPOSE 4000

# Start the app
CMD ["yarn", "run", "start"]

I want to use CI/CD, so I would need to check if the PostgreSQL is updated. This can be done with npx prisma migrate resolve --preview-feature

I thought on always running the prisma migrate to check if the DB is updated, since if a new build changes the schema, the DB should reflect it.

Since K8S pods are ephemeral, is it right to add the npx prisma migrate resolve --preview-feature to the start script, so everytime the app starts, it also checks the DB? I don't think running the prisma migrate all the time is good, but what would it be the solution?

Thanks in advance!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In this case, I would suggest running prisma migrate deploy as mentioned here in your CI/CD step before deploying the application so that you do not need to perform it on every start script which is not ideal in this case.

This migrations just need to be executed once and can be added to your pre-deploy step in your pipeline.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!