This commit is contained in:
2025-04-30 09:51:36 +08:00
parent 561881c9aa
commit 09afa239a6
848 changed files with 385870 additions and 205 deletions

View File

@@ -0,0 +1,16 @@
namespace Yes.Application.Migrators
{
public record MigrateDownCommand(long Version) : IRequest<Unit>;
public class MigrateDownCommandHandler(IMigratorProvider migratorProvider) : IRequestHandler<MigrateDownCommand, Unit>
{
private readonly IMigratorProvider _migratorProvider = migratorProvider;
public async Task<Unit> Handle(MigrateDownCommand request, CancellationToken cancellationToken)
{
_migratorProvider.MigrateDown(request.Version);
return await Task.FromResult(new Unit());
}
}
}

View File

@@ -0,0 +1,16 @@
namespace Yes.Application.Migrators
{
public record MigrateUpCommand(long? Version) : IRequest<Unit>;
public class MigrateUpCommandHandler(IMigratorProvider migratorProvider) : IRequestHandler<MigrateUpCommand, Unit>
{
private readonly IMigratorProvider _migratorProvider = migratorProvider;
public async Task<Unit> Handle(MigrateUpCommand request, CancellationToken cancellationToken)
{
_migratorProvider.MigrateUp(request.Version, ensureDatabase: true);
return await Task.FromResult(new Unit());
}
}
}