-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphinx.php
More file actions
35 lines (32 loc) · 1.08 KB
/
phinx.php
File metadata and controls
35 lines (32 loc) · 1.08 KB
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
require 'vendor/autoload.php';
use Nyholm\Dsn\DsnParser;
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->safeLoad();
date_default_timezone_set(getenv('TIMEZONE'));
$dsn = DsnParser::parse(getenv('DATABASE_URL'));
$scheme = array(
"postgresql"=>"pgsql",
"mysql"=>"mysql"
)[$dsn ->getScheme()];
return array(
'environments' =>
array(
'default_migration_table' => 'phinxlog',
'default_database' => 'production',
'production' => array(
'host' => $dsn ->getHost(),
'name' => ltrim($dsn ->getPath(), "/"),
'user' => $dsn ->getUser(),
'pass' => $dsn ->getPassword(),
'port' => $dsn ->getPort() ?? 3306,
'charset' => 'utf8',
'adapter' => $scheme
)
),
'paths' =>
array(
'migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations',
'seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds'
)
);