Migrate once when loaded
This commit is contained in:
2
app/setup/api/middleware.php
Normal file
2
app/setup/api/middleware.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$app->add($app->getContainer()->get(ProVM\Money\Common\Middleware\Migrate::class));
|
@ -22,5 +22,11 @@ return [
|
||||
'routes'
|
||||
]);
|
||||
return (object) $arr;
|
||||
})
|
||||
}),
|
||||
'phinx' => function(Container $c) {
|
||||
return implode(DIRECTORY_SEPARATOR, [
|
||||
$c->get('locations')->base,
|
||||
'phinx.php'
|
||||
]);
|
||||
}
|
||||
];
|
||||
|
@ -4,5 +4,23 @@ use Psr\Container\ContainerInterface as Container;
|
||||
return [
|
||||
GuzzleHttp\ClientInterface::class => function(Container $c) {
|
||||
return new GuzzleHttp\Client();
|
||||
},
|
||||
ProVM\Common\Factory\Model::class => function(Container $c) {
|
||||
return new ProVM\Common\Factory\Model();
|
||||
},
|
||||
ProVM\Money\Common\Service\Update::class => function(Container $c) {
|
||||
return new ProVM\Money\Common\Service\Update($c->get(ProVM\Common\Factory\Model::class), $c->get(GuzzleHttp\ClientInterface::class));
|
||||
},
|
||||
ProVM\Money\Common\Middleware\Migrate::class => function(Container $c) {
|
||||
return new ProVM\Money\Common\Middleware\Migrate($c->get(Phinx\Wrapper\TextWrapper::class), $c->get(ProVM\Money\Common\Service\Update::class));
|
||||
},
|
||||
Phinx\Console\PhinxApplication::class => function(Container $c) {
|
||||
return new Phinx\Console\PhinxApplication();
|
||||
},
|
||||
Phinx\Wrapper\TextWrapper::class => function(Container $c) {
|
||||
$options = [
|
||||
'configuration' => $c->get('phinx')
|
||||
];
|
||||
return new Phinx\Wrapper\TextWrapper($c->get(Phinx\Console\PhinxApplication::class), $options);
|
||||
}
|
||||
];
|
||||
|
Reference in New Issue
Block a user