From b25b08b5c594ef4460f2bdbbe16f9b377cbaffcc Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 2 Jun 2025 22:05:38 +0800 Subject: [PATCH] :bug: Fixes bugs --- .../Storage/FileService.ReferenceMigration.cs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/DysonNetwork.Sphere/Storage/FileService.ReferenceMigration.cs b/DysonNetwork.Sphere/Storage/FileService.ReferenceMigration.cs index 87a73ef..506e9a6 100644 --- a/DysonNetwork.Sphere/Storage/FileService.ReferenceMigration.cs +++ b/DysonNetwork.Sphere/Storage/FileService.ReferenceMigration.cs @@ -33,7 +33,6 @@ public class FileReferenceMigrationService(AppDatabase db) private async Task ScanPosts() { var posts = await db.Posts - .Include(p => p.OutdatedAttachments) .ToListAsync(); var attachmentsId = posts.SelectMany(p => p.Attachments.Select(a => a.Id)).ToList(); @@ -56,23 +55,7 @@ public class FileReferenceMigrationService(AppDatabase db) }).Where(x => x != null).Select(x => x!) ).ToList(); - foreach (var post in posts) - { - var updatedAttachments = new List(); - foreach (var attachment in post.OutdatedAttachments) - { - if (await db.Files.AnyAsync(f => f.Id == attachment.Id)) - updatedAttachments.Add(attachment.ToReferenceObject()); - else - updatedAttachments.Add(attachment.ToReferenceObject()); - } - - post.Attachments = updatedAttachments; - db.Posts.Update(post); - } - await db.BulkInsertAsync(fileReferences); - await db.SaveChangesAsync(); } private async Task ScanMessages()