1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-21 22:05:43 -04:00

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 Robin Dadswell
parent 7952fd325b
commit 828b994ef4
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;
}
}