-
Notifications
You must be signed in to change notification settings - Fork 64
/
phinx.php
57 lines (50 loc) · 1.89 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
51
52
53
54
55
56
57
<?php
require 'vendor/autoload.php';
$environments = [
'default_migration_table' => 'phinxlog',
];
if (is_file(__DIR__ . '/vendor/behat/behat/composer.json')) {
$kernelDev = new AppKernel('dev', true);
$kernelDev->boot();
$containerDev = $kernelDev->getContainer();
$environments['development'] = [
'adapter' => 'mysql',
'host' => $containerDev->getParameter('database_host'),
'name' => $containerDev->getParameter('database_name'),
'user' => $containerDev->getParameter('database_user'),
'pass' => $containerDev->getParameter('database_password'),
'port' => $containerDev->getParameter('database_port'),
'charset' => 'utf8mb4',
];
$kernelDev = new AppKernel('test', true);
$kernelDev->boot();
$containerDev = $kernelDev->getContainer();
$environments['test'] = [
'adapter' => 'mysql',
'host' => $containerDev->getParameter('database_host'),
'name' => $containerDev->getParameter('database_name'),
'user' => $containerDev->getParameter('database_user'),
'pass' => $containerDev->getParameter('database_password'),
'port' => $containerDev->getParameter('database_port'),
'charset' => 'utf8mb4',
];
}
$kernelProd = new AppKernel('prod', true);
$kernelProd->boot();
$containerProd = $kernelProd->getContainer();
$environments['production'] = [
'adapter' => 'mysql',
'host' => $containerProd->getParameter('database_host'),
'name' => $containerProd->getParameter('database_name'),
'user' => $containerProd->getParameter('database_user'),
'pass' => $containerProd->getParameter('database_password'),
'port' => $containerProd->getParameter('database_port'),
'charset' => 'utf8mb4',
];
return [
'paths' => [
'migrations' => __DIR__ . '/db/migrations',
'seeds' => __DIR__ . '/db/seeds',
],
'environments' => $environments,
];