-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathphinx.php
More file actions
39 lines (36 loc) · 1.25 KB
/
phinx.php
File metadata and controls
39 lines (36 loc) · 1.25 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
36
37
38
39
<?php
/**
* Phinx Configuration File
*
* This file configures Phinx to use the database credentials from config.json
*/
// Load configuration from config.json
$configFile = __DIR__ . '/config.json';
if (!file_exists($configFile)) {
throw new RuntimeException('config.json not found. Please copy config.example.json to config.json and update with your settings.');
}
$config = json_decode(file_get_contents($configFile), true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new RuntimeException('Failed to parse config.json: ' . json_last_error_msg());
}
return [
'paths' => [
'migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations',
'seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'production',
'production' => [
'adapter' => 'mysql',
'host' => $config['mysql_host'],
'name' => $config['mysql_database'],
'user' => $config['mysql_user'],
'pass' => $config['mysql_password'],
'port' => $config['mysql_port'] ?? 3306,
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
]
],
'version_order' => 'creation'
];