修复安装安装时报错
This commit is contained in:
@@ -42,9 +42,12 @@ if (!function_exists('env')) {
|
|||||||
require $baseDir . '/vendor/workerman/webman-framework/src/support/helpers.php';
|
require $baseDir . '/vendor/workerman/webman-framework/src/support/helpers.php';
|
||||||
require $baseDir . '/app/functions.php';
|
require $baseDir . '/app/functions.php';
|
||||||
|
|
||||||
Webman\Config::load($baseDir . '/config', ['route', 'middleware', 'process', 'server', 'static']);
|
use Webman\Config;
|
||||||
// 与 phinx.php 一致直接加载 thinkorm,避免 Webman config() 与 Phinx 表前缀不一致
|
|
||||||
$thinkorm = require $baseDir . '/config/thinkorm.php';
|
Config::clear();
|
||||||
|
Config::load($baseDir . '/config', ['route', 'middleware', 'process', 'server', 'static']);
|
||||||
|
// 与 Webman\ThinkOrm\ThinkOrm::start() 一致,并与 phinx.php 中 $thinkorm 来源一致
|
||||||
|
$thinkorm = array_replace_recursive(config('thinkorm', []), config('think-orm', []));
|
||||||
if (!empty($thinkorm)) {
|
if (!empty($thinkorm)) {
|
||||||
support\think\Db::setConfig($thinkorm);
|
support\think\Db::setConfig($thinkorm);
|
||||||
}
|
}
|
||||||
|
|||||||
15
phinx.php
15
phinx.php
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Phinx 数据库迁移配置
|
* Phinx 数据库迁移配置
|
||||||
* 从 config/thinkorm.php 读取数据库连接,用于 php vendor/bin/phinx migrate
|
* 与 Webman ThinkOrm 引导一致:Config 加载后合并 thinkorm + think-orm,供 phinx migrate 使用
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
@@ -36,7 +36,18 @@ if (!function_exists('env')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$thinkorm = require $baseDir . '/config/thinkorm.php';
|
if (!defined('BASE_PATH')) {
|
||||||
|
define('BASE_PATH', $baseDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
require $baseDir . '/vendor/workerman/webman-framework/src/support/helpers.php';
|
||||||
|
require $baseDir . '/app/functions.php';
|
||||||
|
|
||||||
|
use Webman\Config;
|
||||||
|
|
||||||
|
Config::clear();
|
||||||
|
Config::load($baseDir . '/config', ['route', 'middleware', 'process', 'server', 'static']);
|
||||||
|
$thinkorm = array_replace_recursive(config('thinkorm', []), config('think-orm', []));
|
||||||
$conn = $thinkorm['connections'][$thinkorm['default'] ?? 'mysql'] ?? [];
|
$conn = $thinkorm['connections'][$thinkorm['default'] ?? 'mysql'] ?? [];
|
||||||
$prefix = $conn['prefix'] ?? '';
|
$prefix = $conn['prefix'] ?? '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user