-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphinx.php
54 lines (50 loc) · 1.72 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
<?php
/**
* Cấu hình kết nối database cho Phinx
*
* CHÚ Ý: ĐỪNG SỬA FILE NÀY.
* NẾU CẦN THAY ĐỔI CẤU HÌNH, HÃY SỬA FILE .ENV
*/
const BASE_PATH = __DIR__;
require_once __DIR__ . '/utils/helpers.php';
// Load các biến môi trường từ file .env để sử dụng hàm getenv()
loadEnv();
return
[
'paths' => [
'migrations' => '%%PHINX_CONFIG_DIR%%/database/migrations',
'seeds' => '%%PHINX_CONFIG_DIR%%/database/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'development',
'production' => [
'adapter' => getenv('DB_ADAPTER') ?? 'mysql',
'host' => getenv('DB_HOST') ?? 'localhost',
'name' => getenv('DB_NAME') ?? 'production_db',
'user' => getenv('DB_USER') ?? 'root',
'pass' => getenv('DB_PASS') ?? '',
'port' => getenv('DB_PORT') ?? '3306',
'charset' => getenv('DB_CHARSET') ?? 'utf8mb4',
],
'development' => [
'adapter' => getenv('DB_ADAPTER') ?? 'mysql',
'host' => getenv('DB_HOST') ?? 'localhost',
'name' => getenv('DB_NAME') ?? 'development_db',
'user' => getenv('DB_USER') ?? 'root',
'pass' => getenv('DB_PASS') ?? '',
'port' => getenv('DB_PORT') ?? '3306',
'charset' => getenv('DB_CHARSET') ?? 'utf8mb4',
],
'testing' => [
'adapter' => getenv('DB_ADAPTER') ?? 'mysql',
'host' => getenv('DB_HOST') ?? 'localhost',
'name' => getenv('DB_NAME') ?? 'testing_db',
'user' => getenv('DB_USER') ?? 'root',
'pass' => getenv('DB_PASS') ?? '',
'port' => getenv('DB_PORT') ?? '3306',
'charset' => getenv('DB_CHARSET') ?? 'utf8mb4',
],
],
'version_order' => 'creation'
];