-
Notifications
You must be signed in to change notification settings - Fork 9
/
phinx.php
38 lines (33 loc) · 1.03 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
<?php
require __DIR__ . '/vendor/autoload.php';
$settings = file_get_contents(__DIR__ . '/settings.json');
$settings = json_decode($settings, true);
$dbconf = $settings['db'];
$output = [
'paths' => [
'migrations' => 'database/migrations'
],
'templates' => [
'file' => '%%PHINX_CONFIG_DIR%%/database/templates/create-template.php'
],
'migration_base_class' => '\Dappur\Migration\Migration',
'environments' => [
'default_migration_table' => 'phinxlog',
'default_database' => $settings['environment']
]
];
foreach ($dbconf as $key => $value) {
$output['environments'][$key] = [
'adapter' => $value['driver'],
'host' => $value['host'],
'name' => $value['database'],
'user' => $value['username'],
'pass' => $value['password'],
'port' => $value['port'],
'charset' => $value['charset'],
'collation' => $value['collation'],
'prefix' => $value['prefix'],
'timezone' => $value['timezone']
];
}
return $output;