We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Using migration on multiple databases (but not all) of a server

Hello,

I work for a big european company. We are rewriting our old CMS (php 5.3, Zend Framework) with php 7.0, Phalcon.

We have nearly 20 php servers with around 5000 CMS website per servers. Each of our clients have its own database. For compatibility purphose the database structure and file structure of the clients are keep intact. Only the library part of our CMS is adapted. Also we are creating new modules while making this "update".

For those new modules I would like to implement the usage of the phalcon migration mecanism. On a single server we could have 5000 databases by exemple with names like the DB: 27926, 152636. Every number correspond to single clients database based on the client id. The structures are the same for every clients.

Can we use migration tools to update thoses database wihout impacting for exemple the "project_server" database we could have on the same server with another structure ?

how can we use the config.ini for this? do we have to create a config.ini for each clients? The connection to the database is the same for all clients/projet_server database as we have shared provileges for that.

Thanks for the help.



85.5k

i don't think many people here are using migration tools, including my self ( i also dont use them ), there is this package https://github.com/zachleigh/yarak that looks dope and hopefully can help you ( but i am not sure i have never used any migration tools )



43.9k

Hi,

Can we use migration tools to update thoses database wihout impacting for exemple the "project_server" database we could have on the same server with another structure ?

I would say Yes !

But did you know that migrations aren't phalcon's built in classes, but are provided by phalcon dev tools: https://docs.phalcon.io/en/3.3/db-migrations

<=> you can can hack them easily (if needed) from the the devtools in plain php code :-)

<=> you'll have to write a php cli script that will call 5000 times (eg: all databases from server except a couple of exceptions stored in an array) the migration class