AltHeroes Bot v2
1using AltBot.Core.Models;
2using Microsoft.EntityFrameworkCore;
3using Microsoft.EntityFrameworkCore.Design;
4
5namespace AltBot.Data;
6
7/// <summary>
8/// This factory is used to create the DataContext at design time for EF Core tools (e.g., migrations).
9/// </summary>
10public class DataContextFactory : IDesignTimeDbContextFactory<DataContext>
11{
12 public DataContext CreateDbContext(string[] args)
13 {
14 var optionsBuilder = new DbContextOptionsBuilder<DataContext>();
15 optionsBuilder.UseNpgsql("Host=localhost;Database=test;Username=test;Password=test", options => options.MapEnum<LabelLevel>("label"))
16 .UseSnakeCaseNamingConvention();
17
18 return new DataContext(optionsBuilder.Options);
19 }
20}