forked from glpi-project/telemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphinx.php
50 lines (44 loc) · 1.43 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
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Base installation script
*
* PHP version 7
*
* @category Migration
* @package Telemetry
* @author Johan Cwiklinski <[email protected]>
* @license MIT https://opensource.org/licenses/MIT
* @link https://githu.com/glpi-project/telemetry
*/
if (!file_exists(__DIR__ . '/config.inc.php')) {
throw new \RuntimeException('Configuration file is missing!');
}
require_once __DIR__ . '/config.inc.php';
$dconf = $config['db'];
$pconfig = [
'paths' => [
'migrations' => ['%%PHINX_CONFIG_DIR%%/db/migrations'],
'seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_database' => 'development',
'development' => [
'name' => $dconf['database'],
'adapter' => $dconf['driver'],
'host' => $dconf['host'],
'user' => $dconf['username'],
'pass' => $dconf['password'],
'table_prefix' => $dconf['prefix'],
'charset' => $dconf['charset'],
'collation' => $dconf['collation']
]
]
];
if (file_exists(__DIR__ . '/phinx_local.php')) {
//permit to override $pconfig
//for example to change seeds path
require_once __DIR__ . '/phinx_local.php';
}
return $pconfig;