-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphinx.php
53 lines (47 loc) · 1.73 KB
/
phinx.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
declare(strict_types=1);
use Aphiria\Application\Configuration\Bootstrappers\DotEnvBootstrapper;
use Aphiria\DependencyInjection\Container;
use Aphiria\DependencyInjection\IContainer;
use Aphiria\DependencyInjection\IServiceResolver;
use App\Database\Binders\DatabaseBinder;
require __DIR__ . '/vendor/autoload.php';
/**
* If the DI container does not exist, assume we are invoking Phinx commands directly from the CLI.
* This means we need to manually bootstrap and bind a few things.
*/
if (($container = Container::$globalInstance) === null) {
$container = new Container();
Container::$globalInstance = $container;
$container->bindInstance([IServiceResolver::class, IContainer::class, Container::class], $container);
// Ensure our environment variables are set
new DotEnvBootstrapper(__DIR__ . '/.env')->bootstrap();
// Ensure our database connection is configured
new DatabaseBinder()->bind($container);
}
return [
'paths' => [
'migrations' => '%%PHINX_CONFIG_DIR%%/database/migrations',
'seeds' => '%%PHINX_CONFIG_DIR%%/database/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => \getenv('APP_ENV'),
'production' => [
'adapter' => 'sqlite',
'name' => 'database',
'connection' => $container->resolve(PDO::class)
],
'testing' => [
'adapter' => 'sqlite',
'name' => 'database',
'connection' => $container->resolve(PDO::class)
],
'development' => [
'adapter' => 'sqlite',
'name' => 'database',
'connection' => $container->resolve(PDO::class)
]
],
'version_order' => 'creation'
];