mirror of https://github.com/lidarr/Lidarr
Fixed: Database type when PG host contains ".db" (#4435)
Previously was looking for a ".db" in the connection string, which is the typical sqlite filename. The problem is if your connection string has a .db anywhere in it, such as postgres.db.internal it'll think its a sqlite file Solution borrowed from sonarr: https://github.com/Sonarr/Sonarr/blob/develop/src/NzbDrone.Core/Datastore/Database.cs#L43
This commit is contained in:
parent
5661a0a956
commit
a9c19a89f2
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.SQLite;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
@ -40,14 +41,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
{
|
{
|
||||||
using (var db = _datamapperFactory())
|
using (var db = _datamapperFactory())
|
||||||
{
|
{
|
||||||
if (db.ConnectionString.Contains(".db"))
|
return db is SQLiteConnection ? DatabaseType.SQLite : DatabaseType.PostgreSQL;
|
||||||
{
|
|
||||||
return DatabaseType.SQLite;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return DatabaseType.PostgreSQL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue