/**
* @Author: Will Zheng
* @Wechat: skymouses
* @QQ: 252075062
* @Date: 2021-01-16 01:54:11
* @LastEditors: Will Zheng
* @LastEditTime: 2021-01-19 01:21:09
* @Description: Phinx配置文件
*/
$_envInfo = [];
$_envFile = dirname(__FILE__).'/.env';
if(file_exists($_envFile)){
$__envInfo = parse_ini_file($_envFile, true);
foreach($__envInfo as $_key => $_info){
$_key = strtolower($_key);
if(is_array($_info)){
foreach($_info as $__key => $__info){
$__key = strtolower($__key);
$_envInfo[$_key][$__key] = $__info;
}
}else{
$_envInfo[$_key] = $_info;
}
}
}
$_mapUsageScene = [
'database_production' => 'production',
'database_development' => 'development',
'database_testing' => 'test',
];
$_usageScene = $_envInfo['database']['usage_scene'];
return
[
'paths' => [
'migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations',
'seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_database' => $_mapUsageScene[$_usageScene],
'production' => [
'adapter' => $_envInfo['database_production']['type'],
'host' => $_envInfo['database_production']['hostname'],
'name' => $_envInfo['database_production']['database'],
'user' => $_envInfo['database_production']['username'],
'pass' => $_envInfo['database_production']['password'],
'port' => $_envInfo['database_production']['hostport'],
'charset' => $_envInfo['database_production']['charset'],
'table_prefix' => $_envInfo['database_production']['prefix'],
],
'development' => [
'adapter' => $_envInfo['database_development']['type'],
'host' => $_envInfo['database_development']['hostname'],
'name' => $_envInfo['database_development']['database'],
'user' => $_envInfo['database_development']['username'],
'pass' => $_envInfo['database_development']['password'],
'port' => $_envInfo['database_development']['hostport'],
'charset' => $_envInfo['database_development']['charset'],
'table_prefix' => $_envInfo['database_development']['prefix'],
],
'testing' => [
'adapter' => $_envInfo['database_test']['type'],
'host' => $_envInfo['database_test']['hostname'],
'name' => $_envInfo['database_test']['database'],
'user' => $_envInfo['database_test']['username'],
'pass' => $_envInfo['database_test']['password'],
'port' => $_envInfo['database_test']['hostport'],
'charset' => $_envInfo['database_test']['charset'],
'table_prefix' => $_envInfo['database_test']['prefix'],
]
],
'version_order' => 'creation'
];
一键复制
编辑
Web IDE
原始数据
按行查看
历史