/
phinx.php
40 lines (31 loc) · 1.11 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
<?php
namespace Phinx {
require_once('vendor/autoload.php');
use App\Config\BootLoader;
use Minute\Database\Database;
class PhinxLoader {
/**
* @var Database
*/
private $database;
/**
* PhinxLoader constructor.
*
* @param Database $database
*/
public function __construct(Database $database) {
$this->database = $database;
}
public function getConfiguration() {
$conn = ['environments' => ['default_database' => 'dev', "default_migration_table" => "m_phinx_logs",
'dev' => ['name' => $this->database->getDsn()['database'], 'connection' => $this->database->getPdo()]]];
$paths = ['paths' => ['migrations' => __DIR__ . '/db/migrations']];
return array_merge($paths, $conn);
}
}
/** @var PhinxLoader $phinxLoader */
$bootLoader = new BootLoader();
$injector = $bootLoader->getInjector();
$phinxLoader = $injector->make('Phinx\PhinxLoader');
return $phinxLoader->getConfiguration();
}