diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 52c31b52b..403c0f778 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -28,7 +28,7 @@ body:
label: Kavita Version Number - If you don not see your version number listed, please update Kavita and see if your issue still persists.
multiple: false
options:
- - 0.8.4.2 - Stable
+ - 0.8.5 - Stable
- Nightly Testing Branch
validations:
required: true
diff --git a/API/Data/ManualMigrations/v0.8.5/MigrateProgressExport.cs b/API/Data/ManualMigrations/v0.8.5/MigrateProgressExport.cs
new file mode 100644
index 000000000..67488d337
--- /dev/null
+++ b/API/Data/ManualMigrations/v0.8.5/MigrateProgressExport.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using API.Entities;
+using API.Entities.History;
+using API.Services;
+using CsvHelper;
+using CsvHelper.Configuration.Attributes;
+using Kavita.Common.EnvironmentInfo;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Logging;
+
+namespace API.Data.ManualMigrations;
+
+
+///
+/// v0.8.5 - Progress is extracted and saved in a csv since PDF parser has massive changes
+///
+public static class MigrateProgressExportForV085
+{
+ public static async Task Migrate(DataContext dataContext, IDirectoryService directoryService, ILogger logger)
+ {
+ try
+ {
+ if (await dataContext.ManualMigrationHistory.AnyAsync(m => m.Name == "MigrateProgressExportForV085"))
+ {
+ return;
+ }
+
+ logger.LogCritical(
+ "Running MigrateProgressExportForV085 migration - Please be patient, this may take some time. This is not an error");
+
+ var data = await dataContext.AppUserProgresses
+ .Join(dataContext.Series, progress => progress.SeriesId, series => series.Id, (progress, series) => new { progress, series })
+ .Join(dataContext.Volume, ps => ps.progress.VolumeId, volume => volume.Id, (ps, volume) => new { ps.progress, ps.series, volume })
+ .Join(dataContext.Chapter, psv => psv.progress.ChapterId, chapter => chapter.Id, (psv, chapter) => new { psv.progress, psv.series, psv.volume, chapter })
+ .Join(dataContext.MangaFile, psvc => psvc.chapter.Id, mangaFile => mangaFile.ChapterId, (psvc, mangaFile) => new { psvc.progress, psvc.series, psvc.volume, psvc.chapter, mangaFile })
+ .Join(dataContext.AppUser, psvcm => psvcm.progress.AppUserId, appUser => appUser.Id, (psvcm, appUser) => new
+ {
+ LibraryId = psvcm.series.LibraryId,
+ LibraryName = psvcm.series.Library.Name,
+ SeriesName = psvcm.series.Name,
+ VolumeRange = psvcm.volume.MinNumber + "-" + psvcm.volume.MaxNumber,
+ VolumeLookupName = psvcm.volume.Name,
+ ChapterRange = psvcm.chapter.Range,
+ MangaFileName = psvcm.mangaFile.FileName,
+ MangaFilePath = psvcm.mangaFile.FilePath,
+ AppUserName = appUser.UserName,
+ AppUserId = appUser.Id,
+ PagesRead = psvcm.progress.PagesRead,
+ BookScrollId = psvcm.progress.BookScrollId,
+ ProgressCreated = psvcm.progress.Created,
+ ProgressLastModified = psvcm.progress.LastModified
+ }).ToListAsync();
+
+
+ // Write the mapped data to a CSV file
+ await using var writer = new StreamWriter(Path.Join(directoryService.ConfigDirectory, "progress_export-v0.8.5.csv"));
+ await using var csv = new CsvWriter(writer, CultureInfo.InvariantCulture);
+ await csv.WriteRecordsAsync(data);
+
+ logger.LogCritical(
+ "Running MigrateProgressExportForV085 migration - Completed. This is not an error");
+ }
+ catch (Exception ex)
+ {
+ // On new installs, the db isn't setup yet, so this has nothing to do
+ }
+
+ dataContext.ManualMigrationHistory.Add(new ManualMigrationHistory()
+ {
+ Name = "MigrateProgressExportForV085",
+ ProductVersion = BuildInfo.Version.ToString(),
+ RanAt = DateTime.UtcNow
+ });
+ await dataContext.SaveChangesAsync();
+ }
+}
diff --git a/API/Startup.cs b/API/Startup.cs
index 31b0836c3..262d3c95a 100644
--- a/API/Startup.cs
+++ b/API/Startup.cs
@@ -282,6 +282,7 @@ public class Startup
await ManualMigrateInvalidBlacklistSeries.Migrate(dataContext, logger);
await ManualMigrateScrobbleErrors.Migrate(dataContext, logger);
await ManualMigrateNeedsManualMatch.Migrate(dataContext, logger);
+ await MigrateProgressExportForV085.Migrate(dataContext, directoryService, logger);
// Update the version in the DB after all migrations are run
var installVersion = await unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion);
diff --git a/Kavita.Common/Kavita.Common.csproj b/Kavita.Common/Kavita.Common.csproj
index 7ec13cc91..2e7bd1cdd 100644
--- a/Kavita.Common/Kavita.Common.csproj
+++ b/Kavita.Common/Kavita.Common.csproj
@@ -3,7 +3,7 @@
net9.0
kavitareader.com
Kavita
- 0.8.5.1
+ 0.8.5.0
en
true
true