|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using Dapper;
|
|
|
|
|
using NLog;
|
|
|
|
@ -56,26 +57,13 @@ namespace NzbDrone.Core.Datastore
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
using (var db = _datamapperFactory())
|
|
|
|
|
{
|
|
|
|
|
string version;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
version = db.QueryFirstOrDefault<string>("SHOW server_version");
|
|
|
|
|
|
|
|
|
|
//Postgres can return extra info about operating system on version call, ignore this
|
|
|
|
|
version = Regex.Replace(version, @"\(.*?\)", "");
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
version = db.QueryFirstOrDefault<string>("SELECT sqlite_version()");
|
|
|
|
|
}
|
|
|
|
|
using var db = _datamapperFactory();
|
|
|
|
|
var dbConnection = db as DbConnection;
|
|
|
|
|
var version = Regex.Replace(dbConnection.ServerVersion, @"\(.*?\)", "");
|
|
|
|
|
|
|
|
|
|
return new Version(version);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Migration
|
|
|
|
|
{
|
|
|
|
|