OXIDprojects / oxid-console

OXID Community Console is a php console application for OXID Shop. It provides an API for writing various commands. We have shipped very common for every oxid shop project commands out of the box.
MIT License
7 stars 5 forks source link

how to handle migrations in modules #22

Open alfredbez opened 4 years ago

alfredbez commented 4 years ago

It would be nice to be able to execute migrations from modules directories aswell. Most modules use currently the onActivate() but implement their own logic which reads a SQL file in most cases.

We could overwrite https://github.com/OXIDprojects/oxid-console/blob/83050a0e215b1949c3c1dc081aa734f7dcc60b8a/src/Core/Migration/MigrationHandler.php#L218 to load the migrations not only from the migration directory but from all migration directories in the modules directory.

I'm not sure if this is only needed for running migrations or for generating them, too. That would be a bit more hassle since we need to extend the template to include a specific namespace, put the migration file into a different directory + check if the directory exists etc.

smxsm commented 4 years ago

In the first step it would be enough to just load them from the modules directory. You can always generate them and just copy the files to your module dir.