ThinkAdmin/config/database.php
Anyon e7a8c05556 chore(repo): 统一 v8 仓库品牌名称
将 v8 重构分支中残留的 ThinkAdminDeveloper 文本统一调整为 ThinkAdmin,避免迁移到主仓库后继续暴露旧开发仓库名称。

主要内容:

- 更新 README 标题与项目描述。

- 统一 PHP 文件头注释中的项目标识。

- 同步调整测试、配置、插件与文档中的旧仓库名称文本。

- 保持旧包删除说明与架构边界测试语义不变,只清理品牌名称残留。
2026-05-08 16:15:24 +08:00

87 lines
3.2 KiB
PHP

<?php
declare(strict_types=1);
/**
* +----------------------------------------------------------------------
* | ThinkAdmin Plugin
* +----------------------------------------------------------------------
* | Copyright (c) 2014~2026 ThinkAdmin [ thinkadmin.top ]
* +----------------------------------------------------------------------
* | Official Website: https://thinkadmin.top
* +----------------------------------------------------------------------
* | Licensed: https://mit-license.org
* | Disclaimer: https://thinkadmin.top/disclaimer
* | Vip Rights: https://thinkadmin.top/vip-introduce
* +----------------------------------------------------------------------
* | Gitee Repository: https://gitee.com/zoujingli/ThinkAdmin
* | Github Repository: https://github.com/zoujingli/ThinkAdmin
* +----------------------------------------------------------------------
*/
return [
// 默认使用的数据库连接配置
'default' => env('DB_TYPE', 'sqlite'),
// 自定义时间查询规则
'time_query_rule' => [],
// 自动写入时间戳字段
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 数据库连接配置信息
'connections' => [
'mysql' => [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => env('DB_MYSQL_HOST', '127.0.0.1'),
// 服务器端口
'hostport' => env('DB_MYSQL_PORT', '3306'),
// 数据库名
'database' => env('DB_MYSQL_DATABASE', 'thinkadmin'),
// 用户名
'username' => env('DB_MYSQL_USERNAME', 'root'),
// 密码
'password' => env('DB_MYSQL_PASSWORD', ''),
// 数据库连接参数
'params' => [],
// 数据库表前缀
'prefix' => env('DB_MYSQL_PREFIX', ''),
// 数据库编码默认采用 utf8mb4
'charset' => env('DB_MYSQL_CHARSET', 'utf8mb4'),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 检查字段是否存在
'fields_strict' => true,
// 是否需要断线重连
'break_reconnect' => false,
// 监听SQL执行日志
'trigger_sql' => true,
// 开启字段类型缓存
'fields_cache' => isOnline(),
],
'sqlite' => [
// 数据库类型
'type' => 'sqlite',
// 数据库文件
'database' => runpath('database/sqlite.db'),
// 数据库编码默认采用 utf8
'charset' => 'utf8',
// 监听执行日志
'trigger_sql' => true,
// 其他参数字段
'deploy' => 0,
'suffix' => '',
'prefix' => '',
'hostname' => '',
'hostport' => '',
'username' => '',
'password' => '',
],
],
];