- Merged development into my branch
- New migration added that adds a column, migration is inserted before my migration
- Execute
update-databaseand the migration is applied. Migration is visible in _MigrationHistory table. The column now exists and the model change is applied to db. - EF refuses to believe the model change has been applied and keeps trying to re-generate the same migration when I execute
add-migration.
update-database keeps generating this error:
Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration
How can I tell EF that the model is already applied to db? I can't find, anywhere, how add-migration identifies the changes that need to be put into a migration.
I have no Snapshot file anywhere that can be used. I have tried using fresh, empty databases and applying everything from development and then applying everything from my branch, always the same error.
<TargetFramework>net6.0</TargetFramework>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.7">
EDIT
I tried deleting my migrations before merging with development but, even with my migrations out of the picture (fresh db etc) the same issue happens.
Development branch is fine, development branch knows the migration is applied when update-database is called. As soon as development is merged into my branch it can't identify the changes from the new migration are being applied :<