LANCommander/LANCommander.Server/Startup/Migrations.cs
2026-07-24 18:00:32 -05:00

46 lines
No EOL
2 KiB
C#

using LANCommander.SDK.Migrations;
using LANCommander.SDK.Services;
using LANCommander.Server.Migrations;
namespace LANCommander.Server.Startup;
public static class Migrations
{
public static WebApplicationBuilder AddMigrations(this WebApplicationBuilder builder)
{
// Individual settings file migrations
builder.Services.AddScoped<IMigration, CombineSettingsYamlFromRoot>();
builder.Services.AddScoped<IMigration, CombineSettingsServerYamlFromRoot>();
builder.Services.AddScoped<IMigration, CombineSettingsYamlFromConfig>();
builder.Services.AddScoped<IMigration, CombineSettingsServerYamlFromConfig>();
// Database location migrations
builder.Services.AddScoped<IMigration, SqliteDatabaseLocationMigration>();
// Individual path migrations
builder.Services.AddScoped<IMigration, MoveBackupsMigration>();
builder.Services.AddScoped<IMigration, MoveMediaMigration>();
builder.Services.AddScoped<IMigration, MoveSavesMigration>();
builder.Services.AddScoped<IMigration, MoveSnippetsMigration>();
builder.Services.AddScoped<IMigration, MoveUploadMigration>();
builder.Services.AddScoped<IMigration, MoveUploadsMigration>();
builder.Services.AddScoped<IMigration, MoveServersMigration>();
builder.Services.AddScoped<IMigration, MoveUpdatesMigration>();
builder.Services.AddScoped<IMigration, MoveLauncherMigration>();
builder.Services.AddScoped<IMigration, MoveLogsMigration>();
// Align settings-based storage paths with the unified resolver
builder.Services.AddScoped<IMigration, AlignSettingsStoragePathsMigration>();
return builder;
}
public static async Task<WebApplication> RunApplicationMigrationsAsync(this WebApplication app)
{
var migrationService = app.Services.GetRequiredService<MigrationService>();
await migrationService.MigrateAsync();
return app;
}
}