From fac09303c0546b369db100a18febef8001a390d8 Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 6 Dec 2024 11:20:23 +0000 Subject: [PATCH 1/4] simple db update --- Rdmp.UI/TestsAndSetup/StartupUI.cs | 8 +++---- Rdmp.UI/Versioning/PatchingUI.cs | 38 ++++++++++++++++-------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Rdmp.UI/TestsAndSetup/StartupUI.cs b/Rdmp.UI/TestsAndSetup/StartupUI.cs index e8e89b4073..a8c52fbb9b 100644 --- a/Rdmp.UI/TestsAndSetup/StartupUI.cs +++ b/Rdmp.UI/TestsAndSetup/StartupUI.cs @@ -262,8 +262,8 @@ private void HandleDatabaseFoundOnSimpleUI(PlatformDatabaseFoundEventArgs eventA case RDMPPlatformDatabaseStatus.RequiresPatching: - if (MessageBox.Show($"Patching Required on database of type {eventArgs.Patcher.Name}", "Patch", - MessageBoxButtons.YesNo) == DialogResult.Yes) + if (MessageBox.Show($"Patching Required on database of type {eventArgs.Patcher.Name}", "Patch RDMP", + MessageBoxButtons.OKCancel) == DialogResult.OK) { PatchingUI.ShowIfRequired( eventArgs.Repository.DiscoveredServer.GetCurrentDatabase(), @@ -272,8 +272,8 @@ private void HandleDatabaseFoundOnSimpleUI(PlatformDatabaseFoundEventArgs eventA } else { - MessageBox.Show("Patching was cancelled, application will exit"); - Application.Exit(); + MessageBox.Show("Patching was cancelled. Apply Patch to use the latest version of RDMP. Application will exit."); + Environment.Exit(0); } break; diff --git a/Rdmp.UI/Versioning/PatchingUI.cs b/Rdmp.UI/Versioning/PatchingUI.cs index d168e69380..6a1a4c9ada 100644 --- a/Rdmp.UI/Versioning/PatchingUI.cs +++ b/Rdmp.UI/Versioning/PatchingUI.cs @@ -30,7 +30,7 @@ public partial class PatchingUI : Form private readonly DiscoveredDatabase _database; private readonly ITableRepository _repository; - private bool _yesToAll; + //private bool _yesToAll; private IPatcher _patcher; private PatchingUI(DiscoveredDatabase database, ITableRepository repository, IPatcher patcher) @@ -38,9 +38,8 @@ private PatchingUI(DiscoveredDatabase database, ITableRepository repository, IPa _database = database; _repository = repository; _patcher = patcher; - InitializeComponent(); - + this.btnAttemptPatching.Enabled = false; if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) return; @@ -57,6 +56,8 @@ private PatchingUI(DiscoveredDatabase database, ITableRepository repository, IPa { tbDatabase.Text = $"{_database.GetRuntimeName()}, Version:{repository.GetVersion()}"; } + btnAttemptPatching_Click(null, null); + } private void btnAttemptPatching_Click(object sender, EventArgs e) @@ -69,7 +70,7 @@ private void btnAttemptPatching_Click(object sender, EventArgs e) mds.PatchDatabase(_patcher, toMem, PreviewPatch, - () => MessageBox.Show("Backup Database First", "Backup", MessageBoxButtons.YesNo) == DialogResult.Yes); + () => false); //if it crashed during patching if (toMem.GetWorst() == CheckResult.Fail) @@ -92,7 +93,7 @@ private void btnAttemptPatching_Click(object sender, EventArgs e) checksUI1.OnCheckPerformed(new CheckEventArgs("Patching Successful", CheckResult.Success, null)); - if (MessageBox.Show("Application will now restart", "Close?", MessageBoxButtons.YesNo) == DialogResult.Yes) + if (MessageBox.Show("Application will now restart", "Restart Application", MessageBoxButtons.OK) == DialogResult.OK) ApplicationRestarter.Restart(); } catch (Exception exception) @@ -110,18 +111,19 @@ public static void ShowIfRequired(DiscoveredDatabase database, ITableRepository private bool PreviewPatch(Patch patch) { - if (_yesToAll) - return true; - - var preview = new SQLPreviewWindow(patch.locationInAssembly, "The following SQL Patch will be run:", - patch.GetScriptBody()); - try - { - return preview.ShowDialog() == DialogResult.OK; - } - finally - { - _yesToAll = preview.YesToAll; - } + return true; + //if (_yesToAll) + // return true; + + //var preview = new SQLPreviewWindow(patch.locationInAssembly, "The following SQL Patch will be run:", + // patch.GetScriptBody()); + //try + //{ + // return preview.ShowDialog() == DialogResult.OK; + //} + //finally + //{ + // _yesToAll = preview.YesToAll; + //} } } \ No newline at end of file From 4285051eb2c2b23336c18edc826de8bc6d97294f Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 6 Dec 2024 11:22:52 +0000 Subject: [PATCH 2/4] add changelog --- CHANGELOG.md | 4 ++++ Rdmp.Core/Rdmp.Core.csproj | 5 +++++ Rdmp.UI/Versioning/PatchingUI.cs | 22 +--------------------- SharedAssemblyInfo.cs | 6 +++--- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d53d8f533..fbc77bd8bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [8.4.1] - Unreleased + +- Simplify DB Patching Interface + ## [8.4.0] - 2024-12-02 - Add Ordering to Filters diff --git a/Rdmp.Core/Rdmp.Core.csproj b/Rdmp.Core/Rdmp.Core.csproj index 2de063bb79..c012729cf8 100644 --- a/Rdmp.Core/Rdmp.Core.csproj +++ b/Rdmp.Core/Rdmp.Core.csproj @@ -257,6 +257,11 @@ + + + + + diff --git a/Rdmp.UI/Versioning/PatchingUI.cs b/Rdmp.UI/Versioning/PatchingUI.cs index 6a1a4c9ada..47e9ba8a4c 100644 --- a/Rdmp.UI/Versioning/PatchingUI.cs +++ b/Rdmp.UI/Versioning/PatchingUI.cs @@ -30,7 +30,6 @@ public partial class PatchingUI : Form private readonly DiscoveredDatabase _database; private readonly ITableRepository _repository; - //private bool _yesToAll; private IPatcher _patcher; private PatchingUI(DiscoveredDatabase database, ITableRepository repository, IPatcher patcher) @@ -69,7 +68,7 @@ private void btnAttemptPatching_Click(object sender, EventArgs e) var mds = new MasterDatabaseScriptExecutor(_database); - mds.PatchDatabase(_patcher, toMem, PreviewPatch, + mds.PatchDatabase(_patcher, toMem, (Patch p) => true, () => false); //if it crashed during patching @@ -107,23 +106,4 @@ public static void ShowIfRequired(DiscoveredDatabase database, ITableRepository if (Patch.IsPatchingRequired(database, patcher, out _, out _, out _) == Patch.PatchingState.Required) new PatchingUI(database, repository, patcher).ShowDialog(); } - - - private bool PreviewPatch(Patch patch) - { - return true; - //if (_yesToAll) - // return true; - - //var preview = new SQLPreviewWindow(patch.locationInAssembly, "The following SQL Patch will be run:", - // patch.GetScriptBody()); - //try - //{ - // return preview.ShowDialog() == DialogResult.OK; - //} - //finally - //{ - // _yesToAll = preview.YesToAll; - //} - } } \ No newline at end of file diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs index a672341220..ec5884a345 100644 --- a/SharedAssemblyInfo.cs +++ b/SharedAssemblyInfo.cs @@ -10,6 +10,6 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("8.4.0")] -[assembly: AssemblyFileVersion("8.4.0")] -[assembly: AssemblyInformationalVersion("8.4.0")] +[assembly: AssemblyVersion("8.4.1")] +[assembly: AssemblyFileVersion("8.4.1")] +[assembly: AssemblyInformationalVersion("8.4.1")] From 3ab52f72c8ff73351adfbe88f2ca7ca8acb1d586 Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 6 Dec 2024 11:29:39 +0000 Subject: [PATCH 3/4] revert csproj --- Rdmp.Core/Rdmp.Core.csproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Rdmp.Core/Rdmp.Core.csproj b/Rdmp.Core/Rdmp.Core.csproj index c012729cf8..2de063bb79 100644 --- a/Rdmp.Core/Rdmp.Core.csproj +++ b/Rdmp.Core/Rdmp.Core.csproj @@ -257,11 +257,6 @@ - - - - - From fcd78927e469e8bc0267c05516ae37472e6f2f24 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 6 Jan 2025 11:10:11 +0000 Subject: [PATCH 4/4] tidy up --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a438c74f3..3c4410727d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improve Overview Model Generation Speed - Add Remote Table Without DB Creation Attacher ->>>>>>> 188afdb9501892f22bd66d56cb8d095c49a14fb0 ## [8.4.0] - 2024-12-02