-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphinx.php
35 lines (27 loc) · 902 Bytes
/
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
<?php
/**
* @package InspireVive
* @author Jared King <j@jaredtking.com>
* @link http://jaredtking.com
* @copyright 2015 Jared King
* @license GNU GPLv3
*/
$phinxConfig = [
'environments' => [],
];
$appConfig = @include 'config.php';
$migrationPath = getenv('PHINX_MIGRATION_PATH');
if ($migrationPath) {
$phinxConfig['paths'] = ['migrations' => $migrationPath];
}
// generate database environment from config
foreach ($appConfig['database'] as $k => $environment) {
$environment['adapter'] = $environment['type'];
$environment['pass'] = $environment['password'];
unset($environment['type']);
unset($environment['password']);
$phinxConfig['environments'][$k] = $environment;
}
$phinxConfig['environments']['default_migration_table'] = 'Migrations';
$phinxConfig['environments']['default_database'] = array_keys($appConfig['database'])[0];
return $phinxConfig;