It is expected that EF changes will not change, and yet he complains that there are pending changes. How does EF track this?

I have several migration files in my project, and after making manual changes to my last migration, I don’t want to regenerate it using the “package manager console”. I need to add only 1 column. So, add this manually to the previous migration (I can do this since no one has updated it yet).

Now, when I start my project, the local database seems to be creating my new column, but I get the exception: "It is not possible to update the database to fit the current model, because the expected changes and automatic migration are disabled"

It seems that the only way to solve this problem is to create an additional migration, although this rally creates exactly the same line of code that I wrote manually in the previous migration ...

I was wondering - how does EF track this and is there a way around it?

And one more question - isn't it that I want to limit the number of migration files that I have? Currently, I feel that in an ideal situation, each release of my software should have a maximum of 1 migration file in order to better view my code ...

Thank you,

+4
source share
2 answers
+3

_MigrationHistory. , .

, - . :

  • . , "update-database -target migration MigrationName".

  • , , , .

, - . , .

0

All Articles