fix: align backend APIs and upload flow
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace IM.InitCommon.Management;
|
||||
public static class DeploymentCommands
|
||||
{
|
||||
public static bool ApplyMigrationsIfRequested(this WebApplication app, string[] args)
|
||||
{
|
||||
if (!args.Contains("--migrate")) return false;
|
||||
using var scope = app.Services.CreateScope();
|
||||
foreach (var probe in scope.ServiceProvider.GetServices<ManagementDbProbe>().Where(x => x.Context.Database.GetMigrations().Any()))
|
||||
probe.Context.Database.Migrate();
|
||||
Console.WriteLine("服务数据库迁移完成"); return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user