Hi all! Question about database migrations (dagste...
# ask-community
l
Hi all! Question about database migrations (dagster's db and mine, both postgresql). I'm running everything in production on docker (swarm mode) and it's all happy, but I'm not sure how to manage database migrations (I use alembic for my own db, like dagster): I was running
alembic upgrade
manually, but I'm trying to do things a bit more cleanly. I tried setting the entrypoint of the dagster daemon container to something like
entrypoint: sh -c "alembic upgrade head && dagster-daemon run"
At first sight, it's fine, the migrations work, the daemon is alive, but it seems to have broken the dashboard in some weird ways (like the cool progress charts while a job is running are not updating anymore). What's the recommended way to run migrations?
d
Hi - the recommended way to upgrade the dagster database is via the "dagster instance migrate" command. I don't necessarily recommend running that every time the daemon starts up though, since you should only need to do it when you upgrade and there has been a schema change. Are there any errors in the logs when the app isn't behaving the way you expect after doing a migration?
l
OK, makes sense about the dagster migrations. What about the migrations I create, for my data?
I'm not seeing any obvious errors, but I'll dig a bit more
d
I would need to know more about your setup to give recommendations for non-dagster databases, but we are generally pretty happy with alembic ("dagster instance migrate" uses alembic under the hood)
l
Yeah, I'm using alembic already. I guess your answer implies there isn't any clear best practice then, I'll keep playing around. Thanks for your prompt reply, as always!