using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace ClassNotify.Server.Data; public class ClassNotifyDbContextFactory : IDesignTimeDbContextFactory { public ClassNotifyDbContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder(); // Default local/development connection string for migrations design-time // Note: Real production connection strings are loaded via EnvironmentFile on the VPS var connStr = Environment.GetEnvironmentVariable("ConnectionStrings__DefaultConnection") ?? "Host=127.0.0.1;Port=5432;Database=classnotify;Username=classnotify;Password=CHANGEME_DEV;"; optionsBuilder.UseNpgsql(connStr); return new ClassNotifyDbContext(optionsBuilder.Options); } }