Refactor SQLite Database Provider
- Removed unused classes and files related to SQLite database provider, including SqliteDesignTimeJellyfinDbFactory, ModelBuilderExtensions, PragmaConnectionInterceptor, AssemblyInfo, SqliteDatabaseProvider, DateTimeKindValueConverter. - Updated tests to remove dependencies on removed classes and adjusted mocking for configuration sections. - Added Microsoft.EntityFrameworkCore.Sqlite package reference to test project. - Improved string handling in tests for better consistency and clarity. - Refactored logging methods in JellyfinApplicationFactory for better readability and maintainability.
This commit is contained in:
@@ -64,30 +64,36 @@ public class MigrateKeyframeData : IDatabaseMigrationRoutine
|
||||
_logger.LogInformation("Checking {Count} items for importable keyframe data.", records);
|
||||
|
||||
context.KeyframeData.ExecuteDelete();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
do
|
||||
|
||||
// NpgsqlRetryingExecutionStrategy requires all operations inside a user-initiated
|
||||
// transaction to be wrapped with CreateExecutionStrategy().Execute(...).
|
||||
context.Database.CreateExecutionStrategy().Execute(() =>
|
||||
{
|
||||
var results = baseQuery.Skip(offset).Take(Limit).Select(b => new Tuple<Guid, string?>(b.Id, b.Path)).ToList();
|
||||
foreach (var result in results)
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
do
|
||||
{
|
||||
if (TryGetKeyframeData(result.Item1, result.Item2, out var data))
|
||||
var results = baseQuery.Skip(offset).Take(Limit).Select(b => new Tuple<Guid, string?>(b.Id, b.Path)).ToList();
|
||||
foreach (var result in results)
|
||||
{
|
||||
itemCount++;
|
||||
context.KeyframeData.Add(data);
|
||||
if (TryGetKeyframeData(result.Item1, result.Item2, out var data))
|
||||
{
|
||||
itemCount++;
|
||||
context.KeyframeData.Add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
offset += Limit;
|
||||
if (offset > records)
|
||||
{
|
||||
offset = records;
|
||||
}
|
||||
offset += Limit;
|
||||
if (offset > records)
|
||||
{
|
||||
offset = records;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Checked: {Count} - Imported: {Items} - Time: {Time}", offset, itemCount, sw.Elapsed);
|
||||
} while (offset < records);
|
||||
_logger.LogInformation("Checked: {Count} - Imported: {Items} - Time: {Time}", offset, itemCount, sw.Elapsed);
|
||||
} while (offset < records);
|
||||
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
});
|
||||
|
||||
_logger.LogInformation("Imported keyframes for {Count} items in {Time}", itemCount, sw.Elapsed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user