diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-05-17 15:43:54 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-05-17 15:43:54 -0500 |
| commit | 5d5a79e06c187cedde3682805d259d50ea0e72c7 (patch) | |
| tree | 0a0defe29cf675f04cc4c697f23f6e096d26bd1e /src/slskd/Core/Data | |
| parent | 9d2050a21996df047e20ca4a5da5da346d560008 (diff) | |
| download | slskd-5d5a79e06c187cedde3682805d259d50ea0e72c7.tar.gz | |
copy the TransferStates enum into the migration to ensure it remains stable
Diffstat (limited to 'src/slskd/Core/Data')
| -rw-r--r-- | src/slskd/Core/Data/Migrations/Z04012025_TransferStateMigration.cs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/slskd/Core/Data/Migrations/Z04012025_TransferStateMigration.cs b/src/slskd/Core/Data/Migrations/Z04012025_TransferStateMigration.cs index f18aba55..bf034d6f 100644 --- a/src/slskd/Core/Data/Migrations/Z04012025_TransferStateMigration.cs +++ b/src/slskd/Core/Data/Migrations/Z04012025_TransferStateMigration.cs @@ -24,7 +24,6 @@ using System.IO; using System.Linq; using Microsoft.Data.Sqlite; using Serilog; -using Soulseek; /// <summary> /// Updates the Transfers table to: @@ -83,7 +82,7 @@ public class Z04012025_TransferStateMigration : IMigration while (reader.Read()) { var state = reader.GetString(0); - dict[state] = (int)Enum.Parse(typeof(TransferStates), state); + dict[state] = (int)Enum.Parse(typeof(Z04012025_TransferStateMigration_TransferStates), state); } Log.Debug("State -> int map: {Map}", dict); @@ -205,4 +204,29 @@ public class Z04012025_TransferStateMigration : IMigration throw; } } + +#pragma warning disable SA1201 // Elements should appear in the correct order + /// <summary> + /// This is a copy of the TransferStates enum as it was at the time this migration was written. This exists to ensure + /// that the migration can be applied to any version of the database, even if the enum changes in the future. + /// </summary> + [Flags] + private enum Z04012025_TransferStateMigration_TransferStates + { + None = 0, + Requested = 1, + Queued = 2, + Initializing = 4, + InProgress = 8, + Completed = 16, + Succeeded = 32, + Cancelled = 64, + TimedOut = 128, + Errored = 256, + Rejected = 512, + Aborted = 1024, + Locally = 2048, + Remotely = 4096, + } +#pragma warning restore SA1201 // Elements should appear in the correct order } |
