fix: pg sql error #67
This commit is contained in:
@@ -417,7 +417,7 @@ func (s *BackupService) addDirToZip(zipWriter *zip.Writer, srcDir, prefix string
|
||||
|
||||
func (s *BackupService) GetBackupFile() string {
|
||||
var setting models.Setting
|
||||
res := database.DB.Where("section = ? AND `key` = ?", BackupSection, BackupFileKey).Limit(1).Find(&setting)
|
||||
res := database.DB.Where(&models.Setting{Section: BackupSection, Key: BackupFileKey}).Limit(1).Find(&setting)
|
||||
if res.Error != nil || res.RowsAffected == 0 {
|
||||
return ""
|
||||
}
|
||||
@@ -428,7 +428,7 @@ func (s *BackupService) ClearBackup() error {
|
||||
filePath := s.GetBackupFile()
|
||||
if filePath != "" {
|
||||
os.Remove(filePath)
|
||||
database.DB.Where("section = ? AND `key` = ?", BackupSection, BackupFileKey).Delete(&models.Setting{})
|
||||
database.DB.Where(&models.Setting{Section: BackupSection, Key: BackupFileKey}).Delete(&models.Setting{})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user