I am working with EF Core in Code-First approach. Everything is working well as like EF 6.0 for migration, creating tables, relationships, etc. But, one thing missing with __EFMigrationsHistory table, there should be a column 'Model' to store binary data of migration. Model column was not created when I run update-database command. Please check mine below codes and image.
DbContext
namespace ProfileCore.DataAccess
{
/// <summary>
/// Represents DB Context (DbSet, Configuration and common activities)
/// </summary>
public partial class ProfileCoreDbContext: DbContext, IDbContext
{
#region Ctor
public ProfileCoreDbContext(DbContextOptions<ProfileCoreDbContext> options) : base(options)
{
}
#endregion
#region Authentications DbSets
public virtual DbSet<UserType> UserType { get; set; }
#endregion
#region Utilities
/// <summary>
/// Further configuration the model
/// </summary>
/// <param name="modelBuilder">The builder being used to construct the model for this context</param>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
#endregion
}
}
Update-Command:
Update-Database -Migration 20190703213515_FirstMigration
In EF Core the __EFMigrationsHistory
table has only two columns, so what is shown in your screenshot is correct.
When you run Update-Database
it is not necessary to include the timestamp prefix of your migration. So if you added a migration named FirstMigration
you may end up with a file 20190703213515_FirstMigration.cs
, but what you want to run is this
Update-Database -Migration FirstMigration