Reputation: 2413
In a netstandard20 project, I'm using Npgsql.EntityFrameworkCore.PostgreSQL 3.1.0 and I'm having an issue using Guid
as the type for my primary keys. If I use Database.EnsureCreated()
to create the schema, the primary key columns get created with data type uuid
. With everything the same except changing it to use Database.Migrate()
creates all the primary key columns with data type text
and then I get exception: Npgsql.PostgresException : 42883: operator does not exist: text = uuid
when I try to perform any operations.
There is a single migration in my project to create the initial database. In that migration and also in the "context model snapshot" that are auto-generated, the primary key columns are all defined as Guid
.
I need to both use the Database.Migrate()
method to create the database and also have it create the Guid
primary key columns as uuid
. How can I make sure it creates the columns correctly?
Upvotes: 0
Views: 348
Reputation: 2413
I found this issue and response after posting my question. It led me to the correct answer which was that when I created the migration I was using sqlite. I needed to blow away the migration created against that data provider and regenerate it.
Upvotes: 1