5
votes

In my project I have dozen+ migrations. http://screencast.com/t/CA2kZk3WCFj But when I try to create database from scratch EF only starts from the marked migration to the bottom.

if I enter command: update-database -targetMigration InitialCreate this is the response: he specified target migration 'InitialCreate' does not exist. Ensure that target migration refers to an existing migration id.

How can I resolve this issue and make EF see all of the migrations?

1
Another solution could be to exclude all the migration class files from your project, and then adding a new migration, while targeting the new DB, thus scaffolding a new migration, which contains all of the changes.Tobias
Unfortunately we have multiple running environments, production for example is not running on latest migration. Also there are some custom scripts that would be a pain to collect and merge in new migration.pajics
Check that your migrations are in the correct namespacemichaelmsm89
I can't really test this anymore :). Fixed by recreating migrations from scratch.pajics

1 Answers

0
votes

This can often happen if you use the Update-Database command in Release mode. Running in Debug mode seems to work ok.