Run migrations for everything at once, automagically


#1

Hii there,

I’m working on the deployment of my project to my docker swarm.
Now I have arrived at running the migrations but here’s what I want to get around.
You see, currently, you have to run all the migrations by “hand” one by one.
Ofcourse, this can be automated by making a small script that runs all these commands one by one, but that’s kind of a pain to do.
Due to the way a deployment works, I want to have as little to do with it.
I press “deploy” and off it goes.

Now my question is:
Taking into consideration that I want to automate it all, how would I run the migrations for every plugin (and the app itself)?

basically what happens in my pipeline:
test -> build (install the composer packages and compile the Sass) -> package (build the final images) -> deploy

When the deployment is done and all the services are up, it should run the migrations (or have them already migrated).
Due to the way a deployment works, I cannot simply run the migrations before the deployment is fully done (as the mysql has to be fully started as well).

I hope somebody can help me with this!


#2

Possible solutions:


#3

How did that result not pop up in my search? T_T
I’ll have a look at it

EDIT: I have taken a look at it and it works, but now I need to find a way to run it in my stack automatically :\

UPDATE: I just slammed a little shell script and it works fine now, whoop :smiley: