EF6.1.3 Expects CreatedOn field in __MigrationHistory table when upgrading in VS2015 IDE
<p>in program.cs I have</p>

<pre><code>private static bool CheckMigrationVersionAndUpgradeIfNeeded()
    {
        try
        {
            using (var db = new jtDbContext())
            {
                if (db.Database.CompatibleWithModel(false))
                {
                    return true;
                }
                else
                {
                    return RunMigrations(db);
                }
            }
        }
        catch (Exception ex)
        {
            var s = string.Format("Problem in MigrateIfNeeded /n/p" + ex);
            MessageBox.Show(s);
            return false;
        }
    }

    private static bool RunMigrations(jtDbContext db)
    { 
            if (!AskForPassword()) { return false}
            return db.RunMigrations();
     }    
</code></pre>

<p>in my context i have</p>

<pre><code>    public void RunMigrations()
    {
        var configuration = new Configuration();
        var migrator = new DbMigrator(configuration);
        var pendings = migrator.GetPendingMigrations();
        foreach (var pending in pendings)
        {
            migrator.Update(pending);
        }
    }
</code></pre>

<p>I see from <a href="https://stackoverflow.com/questions/11979026/entity-framework-5-expects-createdon-column-from-migrationhistory-table">this question</a> that there was an issue in EF5 relating to this field.</p>

<p>I am using DevExpress Xaf in the project but I cant see how this could be relevant.</p>

<p>I can still run the migration by typing update-database at the PM> prompt</p>

<p>I can work around the problem by running the following script prior to updating</p>

<pre><code>ALTER TABLE dbo.__MigrationHistory ADD CreatedOn DateTime Default GETDATE()
GO
UPDATE dbo.__MigrationHistory SET CreatedOn = GETDATE()
</code></pre>

<p>[Update] The problem happens when running within the VS2015 Update1 IDE. It does not happen when I run the .exe</p>