using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace InboxIntel.Infrastructure.Persistence; /// /// Design-time factory so `dotnet ef migrations add ...` works without booting /// the full API host. Reads the connection string from the EF_CONNECTION env /// var, falling back to a local default. /// public class AppDbContextFactory : IDesignTimeDbContextFactory { public AppDbContext CreateDbContext(string[] args) { var conn = Environment.GetEnvironmentVariable("EF_CONNECTION") ?? "Host=localhost;Port=5432;Database=inboxintel;Username=inboxintel;Password=inboxintel"; var options = new DbContextOptionsBuilder() .UseNpgsql(conn, o => o.UseVector()) .Options; return new AppDbContext(options); } }