How to fix problems with entity framework migrations - Digital Tool Factory blog How to fix problems with entity framework migrations - Digital Tool Factory blog

How to fix problems with entity framework migrations

  1. First – backup the __MigrationHistory table in the database
  2. Get rid of old migration files
  3. add-migration using the usual syntax, but with nothing modified
  4. Remove all of the “Create Table”, etc – the migration should look like
  5. public partial class domorenow : DbMigration
    {
    public override void Up()
    {

    <code>    }
    
        public override void Down()
        {
    
        }
    }</code>
  6. from there do the update-database -script to generate a sql file
  7. then just update-database -verbose
  8. All Fixed

 

Written By Steve French

 

Leave a Reply

Your email address will not be published. Required fields are marked *






Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.