Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Migration issues

default discord avatar
_vfnlast year
3

Im having some issues when trying to run migrations before starting the payload server. Im using the following command in package.json:

"serve": "payload migrate && node dist/server.js"

, and my Dockerfile looks like this:


FROM base as runtime

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js

WORKDIR /home/node/app
COPY package*.json  ./

RUN yarn install --production && \
    yarn cache clean
COPY --from=builder /home/node/app/dist ./dist
COPY --from=builder /home/node/app/build ./build

EXPOSE 4000

CMD ["yarn", "serve"]

The migrate command finishes successfully but it does not run any migrations. I see that the migration that I expected to be run is in the dist/migrations directory but it does not seem to pick it up.



Is there some configuration or way of telling payload where to look?



I take this as youre not meant to run transpiled migrations:

https://github.com/payloadcms/payload/blob/main/packages/payload/src/database/migrations/readMigrationFiles.ts#L25

But does this mean I have to include all of src in my runtime image to be able to run the migrations through typescript?

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.