0

We have a Web Forms app using VB.NET. When we first started the project a couple years ago, we though DB Migrations was a great idea! However, the actual use of it was not as grand. So we tried to disable it. We followed the steps as outlined in the dozen or so articles including:

  • Remove the Migrations folder
  • Remove the __MigrationHistory table
  • added Database.SetInitializer(Of MyContext)(Nothing) to the constructor of MyContext

I have not found any form of "Disable-Migrations", only re-enabling migrations with more parameters which makes new config files and reinitializes migrations.

Even with all of this, EF keeps querying the database for the __MigrationHistory table which it can't find, so throws an error Invalid object name 'dbo.__MigrationHistory'.

How can we completely remove Migration History so EF stops using it?

Justin Tolchin
  • 423
  • 5
  • 16
  • First, make sure it is not [this problem](https://stackoverflow.com/questions/20877039/invalid-object-name-dbo-migrationhistory-using-database-create-ef6-02-when). Then try using [NullDatabaseInitializer](https://msdn.microsoft.com/en-us/library/dn221749(v=vs.113).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1) – Steve Greene Nov 01 '17 at 16:11
  • Thanks Steve. Maybe I am misunderstanding the core here. It seems like no matter what, EF tries to look for the table. Can that be prevented? – Justin Tolchin Nov 01 '17 at 20:09
  • Also, the docs on NullDatabaseInitializer works the same as passing NULL (or Nothing in my case). Or is there more happening under the covers? – Justin Tolchin Nov 01 '17 at 20:10
  • Is there no counter to "enable-migrations"? – Justin Tolchin Nov 06 '17 at 22:59

0 Answers0