From 48bcbc9b4d74ccde0dd9a887aa8feb46324ab241 Mon Sep 17 00:00:00 2001 From: AntonyCorbett Date: Thu, 12 Dec 2019 16:29:16 +0000 Subject: [PATCH] fix #300 --- OnlyM.Core/Services/Database/DatabaseService.cs | 16 ++++++++++++---- SolutionInfo.cs | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/OnlyM.Core/Services/Database/DatabaseService.cs b/OnlyM.Core/Services/Database/DatabaseService.cs index aa9ee2a62..f8c429d97 100644 --- a/OnlyM.Core/Services/Database/DatabaseService.cs +++ b/OnlyM.Core/Services/Database/DatabaseService.cs @@ -238,11 +238,19 @@ private void DeleteDatabase() private int GetDatabaseSchemaVersion() { - using (var c = CreateConnection()) - using (var cmd = c.CreateCommand()) + try + { + using (var c = CreateConnection()) + using (var cmd = c.CreateCommand()) + { + cmd.CommandText = "select * from pragma_user_version()"; + return Convert.ToInt32(cmd.ExecuteScalar()); + } + } + catch (Exception ex) { - cmd.CommandText = "select * from pragma_user_version()"; - return Convert.ToInt32(cmd.ExecuteScalar()); + Log.Logger.Error(ex, "Could not get database schema version"); + return 0; } } diff --git a/SolutionInfo.cs b/SolutionInfo.cs index 6a0e12101..a2f177959 100644 --- a/SolutionInfo.cs +++ b/SolutionInfo.cs @@ -6,4 +6,4 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.5.0.22")] \ No newline at end of file +[assembly: AssemblyVersion("1.5.0.23")] \ No newline at end of file