aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core/Data/Migrations
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-05-03 17:53:05 -0500
committerJP Dillingham <jp@dillingham.me>2025-05-03 17:53:05 -0500
commit207a645006f75a0fb96f2a1b6a72017f94d42c80 (patch)
tree529c7ccc6c34cdbf84bb27de8109428ada7fc9a0 /src/slskd/Core/Data/Migrations
parentd43c1aba9c07258d9f7f0b9ba59eb6fe33d4bb2c (diff)
downloadslskd-207a645006f75a0fb96f2a1b6a72017f94d42c80.tar.gz
adjust logs
Diffstat (limited to 'src/slskd/Core/Data/Migrations')
-rw-r--r--src/slskd/Core/Data/Migrations/TransferStateMigration_04012025.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/slskd/Core/Data/Migrations/TransferStateMigration_04012025.cs b/src/slskd/Core/Data/Migrations/TransferStateMigration_04012025.cs
index 7229eee4..1ea3ca87 100644
--- a/src/slskd/Core/Data/Migrations/TransferStateMigration_04012025.cs
+++ b/src/slskd/Core/Data/Migrations/TransferStateMigration_04012025.cs
@@ -131,6 +131,8 @@ public class TransferStateMigration_04012025 : IMigration
using var createCommand = new SqliteCommand(create, connection, transaction);
createCommand.ExecuteNonQuery();
+ Log.Information("Schema changes applied, copying data...");
+
/*
copy the existing data into the new table
*/
@@ -149,6 +151,8 @@ public class TransferStateMigration_04012025 : IMigration
using var copyCommand = new SqliteCommand(copy, connection, transaction);
copyCommand.ExecuteNonQuery();
+ Log.Information("Data copied, adjusting columns...");
+
/*
we no longer need the old table, so drop it
*/
@@ -170,10 +174,13 @@ public class TransferStateMigration_04012025 : IMigration
sprinkled in. this should run in reasonable time for large collections
*/
var sw = new Stopwatch();
+ var step = 1;
foreach (var state in stateMapping)
{
sw.Reset();
+ Log.Information("> Updating column {Step} of {Total}. This may take some time...", step++, stateMapping.Count);
+
Log.Debug("Setting {String} to {Int}", state.Key, state.Value);
var mapCommand = new SqliteCommand($"UPDATE Transfers SET State = {state.Value} WHERE State = '{state.Key}';", connection, transaction);
@@ -185,6 +192,7 @@ public class TransferStateMigration_04012025 : IMigration
Log.Debug("Committing transation...");
transaction.Commit();
Log.Debug("Transaction committed!");
+ Log.Information("Done!");
}
catch (Exception)
{