Take the 2-minute tour ×

Using Entity Framework 5 code first, I'm wondering how EF Migrations decides that the target database is at a certain migration version? That is, I've emptied my database (deleted all tables) and am trying to re-do the initial migration via the following command (in the PM console): update-database -targetmigration 201212011907118_Initial. update-database then responds with 'Target database is already at version 201212011907118_Initial'.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Apparently, Code First Migrations maintains a table called 'dbo.__MigrationHistory' in which it stores metadata about applied migrations. This is a system table, which makes it difficult to e.g. delete. See this post for reference.

share|improve this answer
My DB doesn't have the __MigrationHistory table yet but Migrations still tells me that the DB is already at my target version (it's not). –  Josh M. Mar 15 '13 at 16:03
add comment

Your Answer


