I created a desktop application that uses SQL CE 4.0 and the Entity framework with Code First mode . So, first I installed the application on the system, it worked fine.
Now I have added several properties to the model class, so for this purpose I have included migrations with Enable-Migrationsand added a new migration using Add-Migration "MyMigration". It was also successful, and I was able to install the new version and update the database without any problems.
But now, when I install this installation on a system without an existing database, it fails, so after studying, I realized that I need to add the Initial migration . So, I canceled the changes in the model, and also deleted my SQLCE database file, added the initial migration, then Update-Database. Therefore, if I try to update the database using an old database that was created without enabling migration, then it does not work, it tries to apply the initial migration to the database, which should not match me.
Now, if I delete the file of the old database, and then Update-Database, then a new db will be created, and then my changes will be added to the model again and the expected migration will be added.
So, after this, a turn, I can install my application on an empty system, but it does not work on the system with the old database, that is, it does not update the database.
He is also trying to apply Initial-Migration, i.e. create all the tables again and not say that this table already exists, which is not expected.