EF Core failing when executing migration, containing datetime. Works great with EnsureCreated
See original GitHub issueI couldn’t find a similar issue, sorry if there is already an answer of that.
So I’m having the following problem:
I’m trying to create a database from scratch using the code first approach and EF Core migrations.
When I’m using:
context.Database.EnsureCreated();
it works flawlessly and my database gets created.
The problem is when I try with
context.Database.Migrate();
Then I hit an error:
Npgsql.PostgresException: ‘42704: type “datetime” does not exist’
I have some DateTime (C# properties) columns in my entities, but this should not be a problem.
So I’m wondering - why would it work with the first approach, and not with the second one, and is there a solution for this problem?
All kind of help, or guidance appreciated! Thanks!
PS: When I use EnsureCreated()
the columns in PostgreSQL db are timestamps (properly translated).
PSS: Here is a SO issue for that.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
@Babalev Great to hear! I’ll go ahead and close this issue.
Sure. I’ll wrap up some very minimalist console