Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

734
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda