From 4ef3c7d2a39ef4f0d7d9beaae898c6c9398ba664 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sat, 24 Feb 2024 23:21:59 +0200 Subject: [PATCH] Fix --- src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs b/src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs index e5d345c..6726603 100644 --- a/src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs +++ b/src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs @@ -38,22 +38,22 @@ protected override async Task ExecuteAsync(CancellationToken ct) var idDataCount = sqlite.Set().Count(); for (var i = 0; i < idDataCount % take; i+= take) { - var data = await sqlite.Set().Skip(i * take).Take(take).ToArrayAsync(ct); + var data = await sqlite.Set().OrderBy(x => x.FileId).Skip(i * take).Take(take).ToArrayAsync(ct); await postgres.Set().AddRangeAsync(data, ct); } var fileDataCount = sqlite.Set().Count(); for (var i = 0; i < fileDataCount % take; i+= take) { - var data = await sqlite.Set().Skip(i * take).Take(take).ToArrayAsync(ct); + var data = await sqlite.Set().OrderBy(x => x.Id.FileId).Skip(i * take).Take(take).ToArrayAsync(ct); await postgres.Set().AddRangeAsync(data, ct); } var jsonDataCount = sqlite.Set().Count(); for (var i = 0; i < jsonDataCount % take; i+= take) { - var data = await sqlite.Set().Skip(i * take).Take(take).AsAsyncEnumerable() - .SelectAwait(async (x) => new JsonEntity + var data = await sqlite.Set().OrderBy(x => x.Id.FileId).Skip(i * take).Take(take).AsAsyncEnumerable() + .SelectAwait(async x => new JsonEntity { Id = x.Id, CrashReport = await new StreamReader(await _compressor.DecompressAsync(x.CrashReportCompressed, ct)).ReadToEndAsync(ct),