Support Postgres with non-standard version string

(cherry picked from commit 40f4ef27b22113c1dae0d0cbdee8205132bed68a)
This commit is contained in:
Mark McDowall
2024-11-24 20:51:33 -08:00
committed by Bogdan
parent f3b99f68f6
commit 87b3dcd780
3 changed files with 55 additions and 3 deletions
@@ -0,0 +1,16 @@
using System;
using System.Text.RegularExpressions;
namespace NzbDrone.Core.Datastore;
public static class DatabaseVersionParser
{
private static readonly Regex VersionRegex = new (@"^[^ ]+", RegexOptions.Compiled);
public static Version ParseServerVersion(string serverVersion)
{
var match = VersionRegex.Match(serverVersion);
return match.Success ? new Version(match.Value) : null;
}
}