-
Notifications
You must be signed in to change notification settings - Fork 0
/
phinx.php
35 lines (29 loc) · 964 Bytes
/
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
<?php
declare(strict_types=1);
$host = getenv('DATABASE_HOST');
$name = getenv('DATABASE_NAME');
if ($host === false || $name === false) {
throw new RuntimeException('Cannot read database configuration for migrations from environment variables.');
}
$_ENV['PHINX_ENVIRONMENT'] = 'current';
$type = $name === 'poll_hq_event' ? 'event' : 'read';
return [
'paths' => [
'migrations' => ["%%PHINX_CONFIG_DIR%%/db/$type/migrations"],
'seeds' => ["%%PHINX_CONFIG_DIR%%/db/$type/seeds"],
],
'environments' => [
'default_migration_table' => 'migrations',
'default_database' => 'current',
'version_order' => 'creation',
'current' => [
'adapter' => 'pgsql',
'host' => $host,
'name' => $name,
'user' => 'dev',
'pass' => 'dev',
'port' => 5432,
'charset' => 'utf8',
],
],
];