Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

730
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda