mycroforge/MycroForge.CLI/Commands/MycroForge.Orm.Rollback.cs

26 lines
670 B
C#

using System.CommandLine;
using MycroForge.CLI.Commands.Interfaces;
namespace MycroForge.CLI.Commands;
public partial class MycroForge
{
public partial class Orm
{
public class Rollback : Command, ISubCommandOf<Orm>
{
public Rollback() : base("rollback", "Rollback the last migration")
{
this.SetHandler(ExecuteAsync);
}
private async Task ExecuteAsync()
{
await Bash.ExecuteAsync([
"source .venv/bin/activate",
"alembic downgrade -1"
]);
}
}
}
}