handling db migrations
rob8624
HOBBYOP

a year ago

Hi, just looking for some input rather that a specific problem. Whats the 'best' way to run (Django) migrations? I use Dockerfile to build.

I use docker-compose locally in development and can run migrations via command when building containers obviously.

I'm not using docker-compose in Railway, but am using a Dockerfile (added project services 'manually' not via compose) to build from.

I could add migrations command to Dockerfile but it would run on ever push/build.

I have, migrated via railway run , from local machine but this only 'works' using the public db address which would cause charges.

Any advice, appreciated as always.

project ID:n/a

Solved

22 Replies

rob8624
HOBBYOP

a year ago

N/A


medim
MODERATOR

a year ago

use it as a pre-deploy command?



medim
MODERATOR

a year ago

It will run on every re-deploy, if it has schema/migration changes then it will migrate otherwise it will not.


medim
MODERATOR

a year ago

@TheJoker


smoothcubegit
HOBBY

a year ago

Hmm..


rob8624
HOBBYOP

a year ago

Yea, i forgot to say, just run it as a start command? But, isn't this the same principal as running via dockerfile?


rob8624
HOBBYOP

a year ago

In a way i wish there was an internal CLI 'thing' 🙂


smoothcubegit
HOBBY

a year ago

Railway is basically, automated docker etc
Most of it could be done manually, but just REALLY slowly


rob8624
HOBBYOP

a year ago

Yea, i get that, just figuring out my workflow here. (Love Railway btw)


smoothcubegit
HOBBY

a year ago

Same here, having issues with emails however :(



medim
MODERATOR

a year ago

pre deploy commands are ran in a separated container


smoothcubegit
HOBBY

a year ago

Thought so.


medim
MODERATOR

a year ago

but yeah, that's basically it


rob8624
HOBBYOP

a year ago

Ah ok @Medim I'll ditch it from the Dockerfile it's building from and add migration to start command.


smoothcubegit
HOBBY

a year ago

If you have any ideas then just say..


medim
MODERATOR

a year ago

yeah, just read the docs I linked first


medim
MODERATOR

a year ago

it's a very short read


rob8624
HOBBYOP

a year ago

Yea, docs were read (I promise) 😉 Cheers dude


medim
MODERATOR

a year ago

np


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody 12 months ago


Loading...