From bc5026519568bedaf49bc7aba20458d08a8656d7 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 3 Apr 2025 20:17:31 -0500 Subject: update signature, throw on missing database --- src/slskd/Core/Migrations/TransferStateMigration_04012025.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slskd/Core/Migrations/TransferStateMigration_04012025.cs b/src/slskd/Core/Migrations/TransferStateMigration_04012025.cs index 6b03567a..ea295851 100644 --- a/src/slskd/Core/Migrations/TransferStateMigration_04012025.cs +++ b/src/slskd/Core/Migrations/TransferStateMigration_04012025.cs @@ -18,14 +18,21 @@ namespace slskd.Migrations; using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using Microsoft.Data.Sqlite; public class TransferStateMigration_04012025 : IMigration { - public void Apply() - { + private string DbName => "transfers"; + public void Apply(IEnumerable databases) + { + if (!databases.Contains(DbName)) + { + throw new SlskdException($"Attempting to migrate database {DbName} but {DbName} is not in the list of known databases ({string.Join(",", databases)}). This is a precautionary check to ensure databases are properly backed up prior to migration, and the check has failed. Only an application update can fix this; please create an urgent issue: {Program.IssuesUrl}"); + } } static void AddStateDescriptionColumn(string dbPath) -- cgit v1.2.3