using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace TeamUp.Modules.Governance.Persistence; /// Design-time factory so `dotnet ef` can build the internal context without a host. internal sealed class GovernanceDbContextFactory : IDesignTimeDbContextFactory { public GovernanceDbContext CreateDbContext(string[] args) { var connectionString = Environment.GetEnvironmentVariable("ConnectionStrings__Postgres") ?? "Host=localhost;Port=5432;Database=teamup;Username=teamup;Password=teamup"; var options = new DbContextOptionsBuilder() .UseNpgsql(connectionString) .Options; return new GovernanceDbContext(options); } }