R
Railway6mo ago
Cayter

how does one automatically migrate db without pre-deploy actions?

Am using github branch auto deploy and just bumped into this post https://help.railway.app/feedback/pre-and-post-deployment-actions-2c2a4b35. Realised there's no way to run db:migrate command. Why is something fundamental like this not taken care of? Is there a workaround?
11 Replies
Percy
Percy6mo ago
Project ID: N/A
Brody
Brody6mo ago
run db:migrate in your start command
Cayter
CayterOP6mo ago
what if i have multiple server replicas? i have to make sure db:migrate command is guarding against concurrent db:migrate run?
Brody
Brody6mo ago
have a single service do the migrations you would have your main app service with all its replicas, and another migrator service that does the migrations and exits
Cayter
CayterOP6mo ago
is there a way to ensure this single service runs db migrate first? only then deploy the others with the auto deploy? i guess can only be done via github actions with railway cli?
Brody
Brody6mo ago
railway does not have a way to define what services run first i have seen software have a wait for migrations job thats runs before the app starts
Cayter
CayterOP6mo ago
i guess i probably reading the wrong doc https://docs.railway.app/reference/deployments can't seem to find the deployment order thing
Railway Docs
Deployments | Railway Docs
Documentation for Railway
Brody
Brody6mo ago
there is no way to define deployment order at this time
Cayter
CayterOP6mo ago
railway does have a way to define what services run first
what's this referring to?
Brody
Brody6mo ago
im so sorry bad typo, my bad
Cayter
CayterOP6mo ago
oh ok... thx
Want results from more Discord servers?
Add your server