-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphinx.php
More file actions
35 lines (31 loc) · 1.21 KB
/
Copy pathphinx.php
File metadata and controls
35 lines (31 loc) · 1.21 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_once __DIR__ . '/vendor/autoload.php';
if (class_exists(Dotenv\Dotenv::class) && file_exists(__DIR__ . '/.env')) {
if (method_exists(Dotenv\Dotenv::class, 'createUnsafeImmutable')) {
Dotenv\Dotenv::createUnsafeImmutable(__DIR__)->load();
} else {
Dotenv\Dotenv::createMutable(__DIR__)->load();
}
}
$adapter = (string) (getenv('DB_CONNECTION') ?: 'mysql');
$defaultPort = $adapter === 'pgsql' ? '5432' : '3306';
return [
'paths' => [
'migrations' => 'database/migrations',
'seeds' => 'database/seeds',
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'default',
'default' => [
'adapter' => $adapter,
'host' => (string) (getenv('DB_HOST') ?: '127.0.0.1'),
'name' => (string) (getenv('DB_DATABASE') ?: 'xframe'),
'user' => (string) (getenv('DB_USERNAME') ?: ($adapter === 'pgsql' ? 'postgres' : 'root')),
'pass' => (string) (getenv('DB_PASSWORD') ?: ''),
'port' => (string) (getenv('DB_PORT') ?: $defaultPort),
'charset' => $adapter === 'pgsql' ? 'utf8' : 'utf8mb4',
],
],
'version_order' => 'creation',
];