-
Notifications
You must be signed in to change notification settings - Fork 256
Milestone
Description
Broken migrations when using MapEnum
When adding an enum like .MapEnum<MarriageStatus>("marriage_status") and generating a migration, that migration will fail:
Unhandled exception. Npgsql.PostgresException (0x80004005): 42710: type "marriage_status" already exists
I don't understand why this happens, but it seems that the enum is being created in the database before the migration is executed. Then the migration tries to create that same enum again so it fails.
As a workaround I've manually added
migrationBuilder.Sql("DROP TYPE IF EXISTS marriage_status;");before the rest of the migration.
Reproduction
Reproduced using Npgsql.EntityFrameworkCore.PostgreSQL version 9.0.0-rc.2
https://github.com/meenzen/PostgresEnumError