mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-10-23 03:27:39 +09:00
Merge pull request #17565 from twsouthwick/use-datasource
Use DataSource for sqlite db path
This commit is contained in:
1 parent
266434831b
commit
284997ebe2
1 file changed
+13
-2
@@ -287,7 +287,7 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
|
||||
/// <inheritdoc />
|
||||
public async Task<string> MigrationBackupFast(CancellationToken cancellationToken)
|
||||
{
|
||||
var path = Path.Combine(_applicationPaths.DataPath, "jellyfin.db");
|
||||
var path = GetDatabasePath();
|
||||
var backupFolder = Path.Combine(_applicationPaths.DataPath, BackupFolderName);
|
||||
Directory.CreateDirectory(backupFolder);
|
||||
|
||||
@@ -317,7 +317,7 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
|
||||
{
|
||||
// ensure there are absolutely no dangling Sqlite connections.
|
||||
SqliteConnection.ClearAllPools();
|
||||
var path = Path.Combine(_applicationPaths.DataPath, "jellyfin.db");
|
||||
var path = GetDatabasePath();
|
||||
var backupFile = Path.Combine(_applicationPaths.DataPath, BackupFolderName, $"{key}_jellyfin.db");
|
||||
|
||||
if (!File.Exists(backupFile))
|
||||
@@ -390,6 +390,17 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private string GetDatabasePath()
|
||||
{
|
||||
if (DbContextFactory is null)
|
||||
{
|
||||
throw new InvalidOperationException("The database provider has not been initialized.");
|
||||
}
|
||||
|
||||
using var dbContext = DbContextFactory.CreateDbContext();
|
||||
return dbContext.Database.GetDbConnection().DataSource;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task PurgeDatabase(JellyfinDbContext dbContext, IEnumerable<string>? tableNames)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user