How to run db migration in production?

I have an Elixir app and I would like to run an Ecto migration, how do I do that? Can I do it while app is running? Can anyone give me some guidance please?

Hi there!

if you’re used fly launch to create your app and then deployed with fly deploy, the app should run the migration task every deploy automatically.

But to answer your question-- yes, if you really need to, you can run migrations manually. One option is to log into your application with

fly ssh console

then run


That’s a shell script generated during the deploy (using mix release under the hood). It’s included on the docker image copied to the server.

Does that solve your issue?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.