v0.7.3 - The Quality of Life Update (#2036)
* Version bump * Okay this should be the last (#2037) * Fixed improper date visualization for reading list detail page. * Correct not-read badge position (#2034) --------- Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> * Bump versions by dotnet-bump-version. * Merged develop in --------- Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com>
This commit is contained in:
parent
51e23b7eca
commit
1b3866568f
235 changed files with 14827 additions and 21948 deletions
34
API/Data/ManualMigrations/MigrateUserProgressLibraryId.cs
Normal file
34
API/Data/ManualMigrations/MigrateUserProgressLibraryId.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace API.Data.ManualMigrations;
|
||||
|
||||
/// <summary>
|
||||
/// Introduced in v0.6.1.8 and v0.7, this adds library ids to all User Progress to allow for easier queries against progress
|
||||
/// </summary>
|
||||
public static class MigrateUserProgressLibraryId
|
||||
{
|
||||
public static async Task Migrate(IUnitOfWork unitOfWork, ILogger<Program> logger)
|
||||
{
|
||||
logger.LogCritical("Running MigrateUserProgressLibraryId migration - Please be patient, this may take some time. This is not an error");
|
||||
|
||||
var progress = await unitOfWork.AppUserProgressRepository.GetAnyProgress();
|
||||
if (progress == null || progress.LibraryId != 0)
|
||||
{
|
||||
logger.LogCritical("Running MigrateUserProgressLibraryId migration - complete. Nothing to do");
|
||||
return;
|
||||
}
|
||||
|
||||
var seriesIdsWithLibraryIds = await unitOfWork.SeriesRepository.GetLibraryIdsForSeriesAsync();
|
||||
foreach (var prog in await unitOfWork.AppUserProgressRepository.GetAllProgress())
|
||||
{
|
||||
prog.LibraryId = seriesIdsWithLibraryIds[prog.SeriesId];
|
||||
unitOfWork.AppUserProgressRepository.Update(prog);
|
||||
}
|
||||
|
||||
|
||||
await unitOfWork.CommitAsync();
|
||||
|
||||
logger.LogCritical("Running MigrateSeriesRelationsImport migration - Completed. This is not an error");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue