Bugfix/reader progress (#435)
Fixed: Fixed an issue where marking a series as Unread when the DB gets skewed with duplicate progress rows for that item, would break. Now we cleanup any extra rows we see during the operation.
This commit is contained in:
parent
2209a65d52
commit
66f40656dd
6 changed files with 134 additions and 20 deletions
|
@ -9,6 +9,7 @@ using API.Entities.Enums;
|
|||
using API.Services;
|
||||
using Kavita.Common;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace API.Data
|
||||
{
|
||||
|
@ -69,5 +70,21 @@ namespace API.Data
|
|||
await context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
public static async Task SeedSeriesMetadata(DataContext context)
|
||||
{
|
||||
await context.Database.EnsureCreatedAsync();
|
||||
|
||||
context.Database.EnsureCreated();
|
||||
var series = await context.Series
|
||||
.Include(s => s.Metadata).ToListAsync();
|
||||
|
||||
foreach (var s in series)
|
||||
{
|
||||
s.Metadata ??= new SeriesMetadata();
|
||||
}
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue