Open Petah opened 12 years ago
I've kinda started something along these lines, my thoughts were that if you wanted a separate log for each migration sets, you'd have to provide phpmig with an adapter and an array of migrations for each set:
<?php
$container['phpmig.sets']['cms'] = array(
'adapter' => new Phpmig_Adapter_Flat_File(__DIR__ . '/modules/cms/migrations/.migrations.log'),
'migrations' => glob(__DIR__ . '/modules/cms/migrations/*.php'),
);
That way, each database can have their own migrations table etc.
If you're not bothered about having separate logging, I'd just use the globbing e.g. glob(DIR . '/modules//migrations/.php'). In the unlikely event you have a name clash, I'd just change the timestamp on one of the migrations
[deleted]
@reenl was that meant for a different issue?
Sorry see #45
how do you setup that phpmig.sets item, I keep getting Identifier "phpmig.sets" is not defined. when I do it the way described on this post.
seems to be a bug, I forked your code and looking to fix it
This is more of a feature idea.
My projects are made up of a bunch of modules. It would be good if each module could keep its own migrations, but run them as part of an application.
For example I have this directory structure:
Running phpmig on the project directory should run all migrations, including ones in sub modules.
There would be of course problems with the current logging format and DI containers. The logging of migrations that have been run would need to be stored in the project log file/DB. And each sub module would have to have a compatible DI object for accessing the database.
The log file (I haven't used DB logging) could be adapted like so:
I'm happy to implement this, what are you thoughts?