aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Migrator.cs8
-rw-r--r--src/slskd/Program.cs7
2 files changed, 15 insertions, 0 deletions
diff --git a/src/slskd/Core/Migrator.cs b/src/slskd/Core/Migrator.cs
index a83f4764..23580336 100644
--- a/src/slskd/Core/Migrator.cs
+++ b/src/slskd/Core/Migrator.cs
@@ -20,6 +20,7 @@ namespace slskd;
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using Serilog;
using slskd.Migrations;
@@ -60,6 +61,13 @@ public class Migrator
}
}
+ var migrationsNotYetApplied = Migrations.Keys.Except(history.Keys);
+
+ if (!migrationsNotYetApplied.Any())
+ {
+ Log.Debug("No migrations need to be applied");
+ }
+
foreach (var migration in Migrations)
{
if (history.TryGetValue(migration.Key, out var timestamp))
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 50ae7a07..8fbc0522 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -494,6 +494,13 @@ namespace slskd
var app = builder.Build();
+ var migrator = app.Services.GetService<Migrator>();
+
+ if (migrator is not null)
+ {
+ migrator.Migrate();
+ }
+
// hack: services that exist only to subscribe to the event bus are not referenced by anything else
// and are thus never instantiated. force a reference here so they are created.
_ = app.Services.GetService<ScriptService>();