3 months ago
I’m running a monorepo that includes Prisma migrations. Right now, we have separate Dockerfiles for the backend and other services, and the server runs migrations through its entrypoint.
Since we’re using replicas, I want to confirm whether the migration will run in every replica or only once. I also considered running migrations at build time, but that's not recommended, I believe, since that will tie up the DB strictly.
4 Replies
3 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
3 months ago
Hello,
The pre-deploy command is the method you would want to use for running migrations, it will only be run once no matter how many replicas you have.
https://docs.railway.com/guides/pre-deploy-command
Best,
Brody
Status changed to Awaiting User Response Railway • 3 months ago
3 months ago
Hi,
Since we've multiple services, I was wondering if I can run the migration in one container with a entry point and then run the migration, because I'm currently deploying a minified elysia.js binary to the containers.
https://elysiajs.com/patterns/deploy#monorepo
Thanks.
Status changed to Awaiting Railway Response Railway • 3 months ago
3 months ago
Just so I'm understandind this correctly - you have multiple services and you want to ensure the migration is ran first before other services deploy? If so, unfortunately we don't support this at the moment :-/
Status changed to Awaiting User Response Railway • 3 months ago
3 months ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 3 months ago