处理删库重建库没有媒体数据bug

本地文件入库媒体库删除后重新入库导致0条目bug
This commit is contained in:
truewhile
2026-08-19 22:33:23 +08:00
parent 2f1f427b9e
commit 0d9ba2c33a
2 changed files with 11 additions and 1 deletions
+7
View File
@@ -51,6 +51,13 @@ func TestDeleteLibraryHardDeletesLibraryRoots(t *testing.T) {
if visibleLibraryCount != 0 {
t.Fatalf("deleted library should not remain visible, count=%d", visibleLibraryCount)
}
var mediaCount int64
if err := db.Unscoped().Model(&model.Media{}).Where("library_id = ?", lib.ID).Count(&mediaCount).Error; err != nil {
t.Fatal(err)
}
if mediaCount != 0 {
t.Fatalf("local library media rows should be hard deleted, count=%d", mediaCount)
}
}
func TestDeleteCloudLibraryPurgesMountWithoutRecycleBin(t *testing.T) {