fix: backup and restore bool val error #70
This commit is contained in:
@@ -274,7 +274,7 @@ func restoreStreamBatch[T any](tx *gorm.DB, decoder *json.Decoder) error {
|
|||||||
batch = append(batch, &m)
|
batch = append(batch, &m)
|
||||||
|
|
||||||
if len(batch) >= batchSize {
|
if len(batch) >= batchSize {
|
||||||
if err := tx.CreateInBatches(batch, batchSize).Error; err != nil {
|
if err := tx.Select("*").CreateInBatches(batch, batchSize).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
batch = nil // reset batch
|
batch = nil // reset batch
|
||||||
@@ -282,7 +282,7 @@ func restoreStreamBatch[T any](tx *gorm.DB, decoder *json.Decoder) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(batch) > 0 {
|
if len(batch) > 0 {
|
||||||
return tx.CreateInBatches(batch, len(batch)).Error
|
return tx.Select("*").CreateInBatches(batch, len(batch)).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -301,7 +301,7 @@ func (s *BackupService) restoreFromZipFile(tx *gorm.DB, f *zip.File, filename st
|
|||||||
var settings []models.Setting
|
var settings []models.Setting
|
||||||
if err := json.Unmarshal(data, &settings); err == nil {
|
if err := json.Unmarshal(data, &settings); err == nil {
|
||||||
if len(settings) > 0 {
|
if len(settings) > 0 {
|
||||||
return tx.Create(&settings).Error
|
return tx.Select("*").Create(&settings).Error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func (es *EnvService) CreateEnvVar(name, value, remark, envType string, hidden,
|
|||||||
CreatedAt: models.Now(),
|
CreatedAt: models.Now(),
|
||||||
UpdatedAt: models.Now(),
|
UpdatedAt: models.Now(),
|
||||||
}
|
}
|
||||||
database.DB.Create(env)
|
database.DB.Select("*").Create(env)
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ func (ts *TaskService) CreateTask(name, command, schedule string, timeout int, w
|
|||||||
if triggerType != constant.TriggerTypeCron {
|
if triggerType != constant.TriggerTypeCron {
|
||||||
task.NextRun = nil
|
task.NextRun = nil
|
||||||
}
|
}
|
||||||
database.DB.Create(task)
|
database.DB.Select("*").Create(task)
|
||||||
return task
|
return task
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user