diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-03-01 18:52:02 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-03-01 18:52:02 -0600 |
| commit | 225ac9a1a78f743dd0c0ce201b222296ae8528ea (patch) | |
| tree | d444ead05b00fb619777ad13e973c9bbe54492b0 /src | |
| parent | 2cc9adfe04df35326a871ed9bf065402d3376b36 (diff) | |
| download | slskd-225ac9a1a78f743dd0c0ce201b222296ae8528ea.tar.gz | |
rename GroupId to BatchId
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/Data/Migrations/Z2026_02_17_TransferAttemptsAndBatchIdMigration.cs (renamed from src/slskd/Core/Data/Migrations/Z2026_02_17_TransferAttemptsAndGroupIdMigration.cs) | 26 | ||||
| -rw-r--r-- | src/slskd/Core/Data/Migrator.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Transfers/Extensions.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Transfers/TransfersDbContext.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Transfers/Types/Transfer.cs | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/src/slskd/Core/Data/Migrations/Z2026_02_17_TransferAttemptsAndGroupIdMigration.cs b/src/slskd/Core/Data/Migrations/Z2026_02_17_TransferAttemptsAndBatchIdMigration.cs index dfdd68eb..66083a83 100644 --- a/src/slskd/Core/Data/Migrations/Z2026_02_17_TransferAttemptsAndGroupIdMigration.cs +++ b/src/slskd/Core/Data/Migrations/Z2026_02_17_TransferAttemptsAndBatchIdMigration.cs @@ -1,4 +1,4 @@ -// <copyright file="Z2026_02_17_TransferAttemptsAndGroupIdMigration.cs" company="slskd Team"> +// <copyright file="Z2026_02_17_TransferAttemptsAndBatchIdMigration.cs" company="slskd Team"> // Copyright (c) slskd Team. All rights reserved. // // This program is free software: you can redistribute it and/or modify @@ -24,16 +24,16 @@ using Serilog; using slskd.Transfers; /// <summary> -/// Updates the Transfers table to add Attempts and GroupId columns. +/// Updates the Transfers table to add Attempts and BatchId columns. /// </summary> -public class Z2026_02_17_TransferAttemptsAndGroupIdMigration : IMigration +public class Z2026_02_17_TransferAttemptsAndBatchIdMigration : IMigration { - public Z2026_02_17_TransferAttemptsAndGroupIdMigration(ConnectionStringDictionary connectionStrings) + public Z2026_02_17_TransferAttemptsAndBatchIdMigration(ConnectionStringDictionary connectionStrings) { ConnectionString = connectionStrings[Database.Transfers]; } - private ILogger Log { get; } = Serilog.Log.ForContext<Z2026_02_17_TransferAttemptsAndGroupIdMigration>(); + private ILogger Log { get; } = Serilog.Log.ForContext<Z2026_02_17_TransferAttemptsAndBatchIdMigration>(); private string ConnectionString { get; } public bool NeedsToBeApplied() @@ -44,10 +44,10 @@ public class Z2026_02_17_TransferAttemptsAndGroupIdMigration : IMigration var columns = schema["Transfers"]; var indexes = idxes["Transfers"]; - // check to see if the Attempts and GroupId columns exist + // check to see if the Attempts and BatchId columns exist if (columns.Any(c => c.Name == nameof(Transfer.Attempts)) - && columns.Any(c => c.Name == nameof(Transfer.GroupId)) - && indexes.Any(i => i.Name.Equals("IDX_Transfers_GroupId", StringComparison.OrdinalIgnoreCase))) + && columns.Any(c => c.Name == nameof(Transfer.BatchId)) + && indexes.Any(i => i.Name.Equals("IDX_Transfers_BatchId", StringComparison.OrdinalIgnoreCase))) { return false; } @@ -59,7 +59,7 @@ public class Z2026_02_17_TransferAttemptsAndGroupIdMigration : IMigration { if (!NeedsToBeApplied()) { - Log.Information("> Migration {Name} is not necessary or has already been applied", nameof(Z2026_02_17_TransferAttemptsAndGroupIdMigration)); + Log.Information("> Migration {Name} is not necessary or has already been applied", nameof(Z2026_02_17_TransferAttemptsAndBatchIdMigration)); return; } @@ -78,11 +78,11 @@ public class Z2026_02_17_TransferAttemptsAndGroupIdMigration : IMigration command.ExecuteNonQuery(); } - Log.Information("> Adding GroupId and Attempts columns to the Transfers table..."); + Log.Information("> Adding BatchId and Attempts columns to the Transfers table..."); - if (!columns.Any(c => c.Name == nameof(Transfer.GroupId))) + if (!columns.Any(c => c.Name == nameof(Transfer.BatchId))) { - Exec("ALTER TABLE Transfers ADD COLUMN GroupId TEXT NULL;"); + Exec("ALTER TABLE Transfers ADD COLUMN BatchId TEXT NULL;"); } if (!columns.Any(c => c.Name == nameof(Transfer.Attempts))) @@ -94,7 +94,7 @@ public class Z2026_02_17_TransferAttemptsAndGroupIdMigration : IMigration Log.Information("> Adding missing index(es) on the Transfers table..."); - Exec("CREATE INDEX IF NOT EXISTS IDX_Transfers_GroupId ON Transfers (GroupId)"); + Exec("CREATE INDEX IF NOT EXISTS IDX_Transfers_BatchId ON Transfers (BatchId)"); Log.Information("> Index(es) created"); transaction.Commit(); diff --git a/src/slskd/Core/Data/Migrator.cs b/src/slskd/Core/Data/Migrator.cs index a5096143..c1089090 100644 --- a/src/slskd/Core/Data/Migrator.cs +++ b/src/slskd/Core/Data/Migrator.cs @@ -44,7 +44,7 @@ public class Migrator { nameof(Z2025_07_06_TransferIndexesMigration), new Z2025_07_06_TransferIndexesMigration(connectionStrings: Databases) }, { nameof(Z2025_07_26_PrivateMessageWasReplayedMigration), new Z2025_07_26_PrivateMessageWasReplayedMigration(connectionStrings: Databases) }, { nameof(Z2025_12_28_AdditionalTransferIndexesMigration), new Z2025_12_28_AdditionalTransferIndexesMigration(connectionStrings: Databases) }, - { nameof(Z2026_02_17_TransferAttemptsAndGroupIdMigration), new Z2026_02_17_TransferAttemptsAndGroupIdMigration(connectionStrings: Databases) }, + { nameof(Z2026_02_17_TransferAttemptsAndBatchIdMigration), new Z2026_02_17_TransferAttemptsAndBatchIdMigration(connectionStrings: Databases) }, }; } diff --git a/src/slskd/Transfers/Extensions.cs b/src/slskd/Transfers/Extensions.cs index bf139a1d..5a0bd914 100644 --- a/src/slskd/Transfers/Extensions.cs +++ b/src/slskd/Transfers/Extensions.cs @@ -23,7 +23,7 @@ namespace slskd.Transfers { return new Transfer() { - GroupId = transfer.GroupId, + BatchId = transfer.BatchId, Id = transfer.Id, Username = transfer.Username, Direction = transfer.Direction, diff --git a/src/slskd/Transfers/TransfersDbContext.cs b/src/slskd/Transfers/TransfersDbContext.cs index 79171809..d82259e7 100644 --- a/src/slskd/Transfers/TransfersDbContext.cs +++ b/src/slskd/Transfers/TransfersDbContext.cs @@ -83,8 +83,8 @@ namespace slskd.Transfers modelBuilder .Entity<Transfer>() - .HasIndex(t => t.GroupId) - .HasDatabaseName("IDX_Transfers_GroupId"); + .HasIndex(t => t.BatchId) + .HasDatabaseName("IDX_Transfers_BatchId"); // covers the check for existing records when enqueueing uploads and downloads modelBuilder diff --git a/src/slskd/Transfers/Types/Transfer.cs b/src/slskd/Transfers/Types/Transfer.cs index e2ef6d5d..56f6b333 100644 --- a/src/slskd/Transfers/Types/Transfer.cs +++ b/src/slskd/Transfers/Types/Transfer.cs @@ -25,7 +25,7 @@ namespace slskd.Transfers public class Transfer { - public Guid? GroupId { get; init; } = null; + public Guid? BatchId { get; init; } = null; [Key] public Guid Id { get; init; } |
