mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Simplify DatabaseType logic
(cherry picked from commit c5baded3d63a9e77e180023559758108c1ced782)
This commit is contained in:
parent
dc2759ddcb
commit
066d9dd1d4
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
using System.Data.SQLite;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using NLog;
|
using NLog;
|
||||||
@ -39,17 +40,9 @@ public DatabaseType DatabaseType
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
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
Block a user