-
-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53cd327
commit a792ad8
Showing
22 changed files
with
973 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
API.Tests/Services/Test Data/ScannerService/TestCases/Flat Series - Manga.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
"My Dress-Up Darling/My Dress-Up Darling v01.cbz", | ||
"My Dress-Up Darling/My Dress-Up Darling v02.cbz", | ||
"My Dress-Up Darling/My Dress-Up Darling ch 10.cbz" | ||
] |
6 changes: 6 additions & 0 deletions
6
API.Tests/Services/Test Data/ScannerService/TestCases/Flat Series with Specials - Manga.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
"My Dress-Up Darling/My Dress-Up Darling v01.cbz", | ||
"My Dress-Up Darling/My Dress-Up Darling v02.cbz", | ||
"My Dress-Up Darling/My Dress-Up Darling ch 10.cbz", | ||
"My Dress-Up Darling/Specials/Official Anime Fanbook SP05 (2024) (Digital).cbz" | ||
] |
4 changes: 4 additions & 0 deletions
4
API.Tests/Services/Test Data/ScannerService/TestCases/Nested Chapters - Manga.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
"My Dress-Up Darling/Chapter 1/01.cbz", | ||
"My Dress-Up Darling/Chapter 2/02.cbz" | ||
] |
51 changes: 51 additions & 0 deletions
51
API/Data/ManualMigrations/MigrateLowestSeriesFolderPath2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using API.Entities; | ||
using API.Services.Tasks.Scanner.Parser; | ||
using Kavita.Common.EnvironmentInfo; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace API.Data.ManualMigrations; | ||
|
||
/// <summary> | ||
/// v0.8.3 still had a bug around LowestSeriesPath. This resets it for all users. | ||
/// </summary> | ||
public static class MigrateLowestSeriesFolderPath2 | ||
{ | ||
public static async Task Migrate(DataContext dataContext, IUnitOfWork unitOfWork, ILogger<Program> logger) | ||
{ | ||
if (await dataContext.ManualMigrationHistory.AnyAsync(m => m.Name == "MigrateLowestSeriesFolderPath2")) | ||
{ | ||
return; | ||
} | ||
|
||
logger.LogCritical( | ||
"Running MigrateLowestSeriesFolderPath2 migration - Please be patient, this may take some time. This is not an error"); | ||
|
||
var series = await dataContext.Series.Where(s => !string.IsNullOrEmpty(s.LowestFolderPath)).ToListAsync(); | ||
foreach (var s in series) | ||
{ | ||
s.LowestFolderPath = string.Empty; | ||
unitOfWork.SeriesRepository.Update(s); | ||
} | ||
|
||
// Save changes after processing all series | ||
if (dataContext.ChangeTracker.HasChanges()) | ||
{ | ||
await dataContext.SaveChangesAsync(); | ||
} | ||
|
||
dataContext.ManualMigrationHistory.Add(new ManualMigrationHistory() | ||
{ | ||
Name = "MigrateLowestSeriesFolderPath2", | ||
ProductVersion = BuildInfo.Version.ToString(), | ||
RanAt = DateTime.UtcNow | ||
}); | ||
|
||
await dataContext.SaveChangesAsync(); | ||
logger.LogCritical( | ||
"Running MigrateLowestSeriesFolderPath2 migration - Completed. This is not an error"); | ||
} | ||
} |
Oops, something went wrong.