'Ef Core Model Snapshot caching or is out of Sync

I'm using efcore and I scaffolded from an existing database, but I forgot to make an initial migration when I did that so it picked up my new model. I decided that I wanted to keep them separate so I removed the migration, deleted the snapshot, and now every time I create another migration, it still has the new model in it.

On top of this, using dotnet ef migrations list will list pending migrations that no longer exist. If I do dotnet ef database update they will get 'migrated` and show up in __MigrationHistory, but again, they don't actually exist in the directory.

I've tried creating the files again, going as far as adding the class names to the files, doing a dotnet ef migrations remove, but I still have the same issue. It will delete the files, tell me everything is rolled back, but then the files will still be listed as pending, the database snapshot will still contain the new table (that doesn't exist) if I do any future migrations.

Not really sure how to proceed. Everything I've read says that if I delete the snapshot and migrations, it will create a fresh snapshot, but it doesn't seem to do that. Is this stuff cached somewhere locally that I can clear out?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source