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 da07a60 commit 4ef3c7d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/BUTR.CrashReportServer/Services/DatabaseMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ protected override async Task ExecuteAsync(CancellationToken ct)
var idDataCount = sqlite.Set<IdEntity>().Count();
for (var i = 0; i < idDataCount % take; i+= take)
{
var data = await sqlite.Set<IdEntity>().Skip(i * take).Take(take).ToArrayAsync(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);
}

var fileDataCount = sqlite.Set<FileEntity>().Count();
for (var i = 0; i < fileDataCount % take; i+= take)
{
var data = await sqlite.Set<FileEntity>().Skip(i * take).Take(take).ToArrayAsync(ct);
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);
}

var jsonDataCount = sqlite.Set<OldJsonEntity>().Count();
for (var i = 0; i < jsonDataCount % take; i+= take)
{
var data = await sqlite.Set<OldJsonEntity>().Skip(i * take).Take(take).AsAsyncEnumerable()
.SelectAwait(async (x) => new JsonEntity
var data = await sqlite.Set<OldJsonEntity>().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),
Expand Down

0 comments on commit 4ef3c7d

Please sign in to comment.