ARTICLE AD BOX
I have a class with a collection of enums mapped into PostgreSQL native enum:
internal class EventStackFilter { // other properties omitted public List<EventStackEventStatus> Statuses { get; set; } = []; }The enum is mapped like so:
services.AddDbContext<DatabaseContext>(options => { options.UseNpgsql( CreateConnString(variables.DatabaseName), npsqlOptions => { npsqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery); npsqlOptions.MapEnum<DataPointCommandExecutionState>(); npsqlOptions.MapEnum<EventStackEventStatus>(); }); options.UseDataSeeding(); options.ConfigureWarnings(c => c.Log((RelationalEventId.CommandExecuted, LogLevel.Debug))); }, ServiceLifetime.Transient);migration adding the enum:
migrationBuilder.AlterDatabase() .Annotation("Npgsql:Enum:data_point_command_execution_state", "completed,failed,in_progress,none,unknown") .Annotation("Npgsql:Enum:event_stack_event_status", "closed,new,taken,unknown") .OldAnnotation("Npgsql:Enum:data_point_command_execution_state", "completed,failed,in_progress,none,unknown"); migrationBuilder.CreateTable( name: "event_stack_filters", columns: table => new { //other irrelevant properties statuses = table.Column<List<EventStackEventStatus>>(type: "event_stack_event_status[]", nullable: false) },Using the other mapped enum is working just fine, but when data seeder tries to add data to EventStackFilter it results in error:
System.NotSupportedException: The data type name '_event_stack_event_status' isn't present in your database. You may need to install an extension or upgrade to a newer version.
I don't know what I'm doing wrong here
