Open iPilot opened 1 year ago
https://github.com/iPilot/NpgSqlEnumBug
Repro repo (see b1531bd7e690485da0bc96ab00d51723db1674ee @ master)
After few iterations I've figured out that column type mapping also depends on NpgSqlDatasourceBuilder.MapEnum<T>
but there is still inconsistency:
Workaround is to call NpgSqlDatasourceBuilder.MapEnum<T>(${schema}.\"{typeName}\"
) explicitly, but it requires to explicitly configure type name in HasPostgresEnum<T>
call.
If default calls of HasPostgresEnum<T>
and MapEnum<T>
(with no arguments) are used for configuration, but database default schema is overridden, then exception will be thrown on database update.
On enum mapping to db type with non-default schema, enum type is created correctly, but columns of that type are mapped to db type with default schema, so update-database command leads to error "type "" does not exist"
Although the annotation creation command does not contain the schema, it is implicitly applied for an enum type, but not for a column that has that type.
Also, ensure schema is triggered 3 times - every HasPostgresEnum adds to migration script schema creation command even when the type's schema equals to a default database schema.