Type for Arrays of Enums not set during migration
With an enum type mapped like so:
protected override void OnModelCreating(ModelBuilder builder) {
builder.ForNpgsqlHasEnum("Mood", new[] { "happy", "sad" });
}
static MyDbContext()
{
NpgsqlConnection.GlobalTypeMapper.MapEnum<Mood>("Mood");
}
And an array defined like so:
public List<Mood> Moods{ get; set; }
Throws :
42704: type "Mood[]" does not exist
I think the issue is the generated SQL does not type the array specifically, like so:
ARRAY['happy','sad']::Mood[]
Issue was caused by the casing of the enum.
When mapping used mood instead of Mood the migration went smoothly.
I'll update the docs to point out this caveat.
This looks like a duplicate of #440.
Can you post some version information?
With an enum type mapped like so:
protected override void OnModelCreating(ModelBuilder builder) { builder.ForNpgsqlHasEnum("Mood", new[] { "happy", "sad" }); }Throws :
42704: type "Mood[]" does not exist
That configuration is correct for the quoted PostgreSQL identifier:
CREATE TYPE "Mood" AS ENUM ('sad', 'ok', 'happy');
Yep, agree with @austindrenski that this is a dup of #440 - I intend to release 2.1.1 this weekend so this should be gone. @JNBarnes can you please test the latest nupkg from the stable feed and report if it resolves the issue for you?
Closing as no additional info was provided within 7 days. But please feel free to post back here with the relevant information and I'll reopen if necessary.