更新数据表或者表字段备注

This commit is contained in:
evoxwht 2023-04-11 18:25:45 +08:00
parent a20838259c
commit f5fa1b7134
2 changed files with 27 additions and 0 deletions

View File

@ -11,6 +11,7 @@
namespace app\adminapi\controller\v1\system;
use think\facade\App;
use think\facade\Db;
use think\facade\Session;
use app\adminapi\controller\AuthController;
use app\services\system\SystemDatabackupServices;
@ -53,6 +54,30 @@ class SystemDatabackup extends AuthController
return app('json')->success($this->services->getRead($tablename));
}
/**
* 更新数据表或者表字段备注
* @return \think\Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/11
*/
public function updateMark()
{
[$table, $field, $type, $mark] = $this->request->postMore([
['table', ''],
['field', ''],
['type', ''],
['mark', ''],
], true);
if ($field == '') {
$sql = "ALTER TABLE $table COMMENT '$mark'";
} else {
$sql = "ALTER TABLE $table MODIFY COLUMN $field $type COMMENT '$mark'";
}
Db::execute($sql);
return app('json')->success(100024);
}
/**
* 优化表
*/

View File

@ -49,6 +49,8 @@ Route::group('system', function () {
Route::get('backup', 'v1.system.SystemDatabackup/index')->option(['real_name' => '数据库所有表']);
//数据备份详情
Route::get('backup/read', 'v1.system.SystemDatabackup/read')->option(['real_name' => '数据备份详情']);
//更新数据表或者表字段备注
Route::post('database/update_mark', 'v1.system.SystemDatabackup/updateMark')->option(['real_name' => '更新数据表或者表字段备注']);
//数据备份 优化表
Route::put('backup/optimize', 'v1.system.SystemDatabackup/optimize')->option(['real_name' => '数据备份优化表']);
//数据备份 修复表