mycroforge/MycroForge.CLI/Commands/MycroForge.Migrations.Apply.cs

27 lines
715 B
C#

using System.CommandLine;
using MycroForge.CLI.Commands.Interfaces;
namespace MycroForge.CLI.Commands;
public partial class MycroForge
{
public partial class Migrations
{
public class Apply : Command, ISubCommandOf<Migrations>
{
public Apply() : base("apply", "Apply migrations to the database")
{
AddAlias("a");
this.SetHandler(ExecuteAsync);
}
private async Task ExecuteAsync()
{
await Bash.ExecuteAsync([
"source .venv/bin/activate",
"alembic upgrade head"
]);
}
}
}
}