aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/slskd.example.yml1
-rw-r--r--src/slskd/Core/Migrator.cs2
-rw-r--r--src/slskd/Core/Options.cs8
-rw-r--r--src/slskd/Program.cs2
4 files changed, 11 insertions, 2 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml
index 9cd9584f..621b5564 100644
--- a/config/slskd.example.yml
+++ b/config/slskd.example.yml
@@ -10,6 +10,7 @@
# no_connect: false
# no_share_scan: false
# force_share_scan: false
+# force_migrations: false
# no_version_check: false
# log_sql: false
# experimental: false
diff --git a/src/slskd/Core/Migrator.cs b/src/slskd/Core/Migrator.cs
index 23580336..b9e98f4c 100644
--- a/src/slskd/Core/Migrator.cs
+++ b/src/slskd/Core/Migrator.cs
@@ -39,7 +39,7 @@ public class Migrator
{ nameof(TransferStateMigration_04012025), new TransferStateMigration_04012025() },
};
- public void Migrate()
+ public void Migrate(bool force = false)
{
Dictionary<string, DateTime> history = new();
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 266d04aa..870a1e83 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -392,6 +392,14 @@ namespace slskd
public bool ForceShareScan { get; init; } = false;
/// <summary>
+ /// Gets a value indicating whether to force database migrations to be applied on startup.
+ /// </summary>
+ [Argument(default, "force-migrations")]
+ [EnvironmentVariable("FORCE_MIGRATIONS")]
+ [Description("force database migrations to be applied on startup")]
+ public bool ForceMigrations { get; init; } = false;
+
+ /// <summary>
/// Gets a value indicating whether the application should check for a newer version on startup.
/// </summary>
[Argument(default, "no-version-check")]
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 8fbc0522..068e62ae 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -498,7 +498,7 @@ namespace slskd
if (migrator is not null)
{
- migrator.Migrate();
+ migrator.Migrate(force: OptionsAtStartup.Flags.ForceMigrations);
}
// hack: services that exist only to subscribe to the event bus are not referenced by anything else