release: v1.9.0

This commit is contained in:
meilin.huang
2024-10-23 17:30:05 +08:00
parent 44a1bd626e
commit 2118acf244
26 changed files with 60 additions and 59 deletions

View File

@@ -84,10 +84,6 @@ func (d *dbAppImpl) SaveDb(ctx context.Context, dbEntity *entity.Db) error {
if err == nil {
return errorx.NewBiz("该实例下数据库名已存在")
}
if d.CountByCond(&entity.Db{Name: dbEntity.Name}) > 0 {
return errorx.NewBiz("该编码已存在")
}
dbEntity.Code = stringx.Rand(10)
return d.Tx(ctx, func(ctx context.Context) error {

View File

@@ -105,10 +105,6 @@ func (app *instanceAppImpl) SaveDbInstance(ctx context.Context, instance *dto.Sa
if err == nil {
return 0, errorx.NewBiz("该数据库实例已存在")
}
if app.CountByCond(&entity.DbInstance{Name: instanceEntity.Name}) > 0 {
return 0, errorx.NewBiz("该名称已存在")
}
instanceEntity.Code = stringx.Rand(10)
return instanceEntity.Id, app.Tx(ctx, func(ctx context.Context) error {

View File

@@ -184,7 +184,6 @@ func (app *dbTransferAppImpl) CreateLog(ctx context.Context, taskId uint64) (uin
}
func (app *dbTransferAppImpl) Run(ctx context.Context, taskId uint64, logId uint64) {
task, err := app.GetById(taskId)
if err != nil {
logx.Errorf("创建DBMS-执行数据迁移日志失败:%v", err)
@@ -288,15 +287,16 @@ func (app *dbTransferAppImpl) transfer2File(ctx context.Context, taskId uint64,
}
// 2、把源库数据迁移到文件
app.Log(ctx, logId, fmt.Sprintf("开始迁移表数据到文件: %s", filename))
app.Log(ctx, logId, fmt.Sprintf("目标库文件语言类型: %s", task.TargetFileDbType))
go func() {
defer saveFileFunc()
var err error
defer saveFileFunc(&err)
defer app.MarkStop(taskId)
defer app.logApp.Flush(logId, true)
ctx = context.Background()
err := app.dbApp.DumpDb(ctx, &dto.DumpDb{
err = app.dbApp.DumpDb(ctx, &dto.DumpDb{
LogId: logId,
DbId: uint64(task.SrcDbId),
DbName: task.SrcDbName,
@@ -313,8 +313,6 @@ func (app *dbTransferAppImpl) transfer2File(ctx context.Context, taskId uint64,
app.EndTransfer(ctx, logId, taskId, "数据库迁移失败", err, nil)
tFile.Status = entity.DbTransferFileStatusFail
_ = app.transferFileApp.UpdateById(ctx, tFile)
// 删除文件
_ = app.fileApp.Remove(ctx, fileKey)
return
}
app.EndTransfer(ctx, logId, taskId, "数据库迁移完成", err, nil)
@@ -323,7 +321,6 @@ func (app *dbTransferAppImpl) transfer2File(ctx context.Context, taskId uint64,
tFile.FileKey = fileKey
_ = app.transferFileApp.UpdateById(ctx, tFile)
}()
}
func (app *dbTransferAppImpl) Stop(ctx context.Context, taskId uint64) error {

View File

@@ -36,7 +36,7 @@ func InitDbRouter(router *gin.RouterGroup) {
req.NewPost(":dbId/exec-sql", d.ExecSql).Log(req.NewLog("db-执行Sql")),
req.NewPost(":dbId/exec-sql-file", d.ExecSqlFile).Log(req.NewLogSave("db-执行Sql文件")),
req.NewPost(":dbId/exec-sql-file", d.ExecSqlFile).Log(req.NewLogSave("db-执行Sql文件")).RequiredPermissionCode("db:sqlscript:run"),
req.NewGet(":dbId/dump", d.DumpSql).Log(req.NewLogSave("db-导出sql文件")).NoRes(),