Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Feb 24, 2024
1 parent 4ef3c7d commit 5870c55
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ protected override async Task ExecuteAsync(CancellationToken ct)
{
var data = await sqlite.Set<IdEntity>().OrderBy(x => x.FileId).Skip(i * take).Take(take).ToArrayAsync(ct);
await postgres.Set<IdEntity>().AddRangeAsync(data, ct);
await postgres.SaveChangesAsync(ct);
}

var fileDataCount = sqlite.Set<FileEntity>().Count();
for (var i = 0; i < fileDataCount % take; i+= take)
{
var data = await sqlite.Set<FileEntity>().OrderBy(x => x.Id.FileId).Skip(i * take).Take(take).ToArrayAsync(ct);
await postgres.Set<FileEntity>().AddRangeAsync(data, ct);
await postgres.SaveChangesAsync(ct);
}

var jsonDataCount = sqlite.Set<OldJsonEntity>().Count();
Expand All @@ -59,6 +61,7 @@ protected override async Task ExecuteAsync(CancellationToken ct)
CrashReport = await new StreamReader(await _compressor.DecompressAsync(x.CrashReportCompressed, ct)).ReadToEndAsync(ct),
}).ToArrayAsync(ct);
await postgres.Set<JsonEntity>().AddRangeAsync(data, ct);
await postgres.SaveChangesAsync(ct);
}
}
}

0 comments on commit 5870c55

Please sign in to comment.