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

2 years ago

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?

0 Replies

brody
EMPLOYEE

2 years ago

run db:migrate in your start command


cayter
TRIALOP

2 years ago

what if i have multiple server replicas? i have to make sure db:migrate command is guarding against concurrent db:migrate run?


brody
EMPLOYEE

2 years ago

have a single service do the migrations


brody
EMPLOYEE

2 years ago

you would have your main app service with all its replicas, and another migrator service that does the migrations and exits


cayter
TRIALOP

2 years 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
EMPLOYEE

2 years ago

railway does not have a way to define what services run first


brody
EMPLOYEE

2 years ago

i have seen software have a wait for migrations job thats runs before the app starts


cayter
TRIALOP

2 years ago

i guess i probably reading the wrong doc https://docs.railway.app/reference/deployments can't seem to find the deployment order thing


brody
EMPLOYEE

2 years ago

there is no way to define deployment order at this time


cayter
TRIALOP

2 years ago

railway does have a way to define what services run first

what's this referring to?


brody
EMPLOYEE

2 years ago

im so sorry


brody
EMPLOYEE

2 years ago

bad typo, my bad


cayter
TRIALOP

2 years ago

oh ok… thx


Loading...