30 lines
794 B
C#
30 lines
794 B
C#
using System.CommandLine;
|
|
using MycroForge.Core;
|
|
using MycroForge.Core.Contract;
|
|
|
|
namespace MycroForge.CLI.Commands;
|
|
|
|
public partial class MycroForge
|
|
{
|
|
public partial class Db
|
|
{
|
|
public class Rollback : Command, ISubCommandOf<Db>
|
|
{
|
|
private readonly ProjectContext _context;
|
|
|
|
public Rollback(ProjectContext context) : base("rollback", "Rollback the last migration")
|
|
{
|
|
_context = context;
|
|
this.SetHandler(ExecuteAsync);
|
|
}
|
|
|
|
private async Task ExecuteAsync()
|
|
{
|
|
await _context.Bash([
|
|
"source .venv/bin/activate",
|
|
"alembic downgrade -1"
|
|
]);
|
|
}
|
|
}
|
|
}
|
|
} |