Answer the question
In order to leave comments, you need to log in
How to do an EFCore migration update?
Good evening gentlemen. Tell me please. I'm doing a small project and ran into a problem. After I successfully did Update-Migration for the first time and tables were created in the database, I tried to simply add a field to the model and update the database. EFCore constantly issues that the table already exists. But there are changes. It is obtained instead of alter table executing create table. What could be my mistake? Unfortunately I can't post the code.
Answer the question
In order to leave comments, you need to log in
With each change of models and/or their connections, you must first generate the next migration ( Add-Migration
), and then roll the changes onto the schema ( Update-Database
).
The CLI would be like this:
dotnet ef migrations add NewMigrationName;
dotnet ef database update;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question