My tech blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
929 B

<?php
$config = require_once __DIR__ . '/config.php';
function dsn_to_array(string $dsn): array
{
assert(false !== strpos($dsn, ':'), 'DSN should start with the driver');
$settings = explode(':', $dsn, 2);
$tokens = preg_split('/[ ;]/', $settings[1]);
return array_merge(
['driver' => $settings[0]],
...array_map(function ($token) {
$keyValue = explode('=', $token, 2);
return [$keyValue[0] => $keyValue[1]];
}, $tokens)
);
}
$db_config = dsn_to_array($config['db']);
return [
'paths' => [
'migrations' => ROOT . '/db/migrations',
'seeds' => ROOT . '/db/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'db',
'db' => [
'adapter' => $db_config['driver'],
'host' => $db_config['host'],
'name' => $db_config['dbname'],
'user' => $db_config['user'] ?? '',
'pass' => $db_config['password'] ?? ''
]
],
'version_order' => 'creation'
];