ASP.NET MVC MySql数据库到PLESK的迁移

ASP.NET MVC MySql数据库到PLESK的迁移,mysql,entity-framework,database-migration,production-environment,Mysql,Entity Framework,Database Migration,Production Environment,我已将我的Asp.NET项目发布到Plesk,它已成功完成。 现在我需要使用PM更新数据库,但它会为“ASPNETROLES”创建表,然后抛出异常 指定的密钥太长;最大密钥长度为767字节 我找到了以下解决方案,但没有一个有效: 我已尝试以下代码,但失败: [DbConfigurationType(typeof(MySqlEFConfiguration))] public class AppIdentityDbContext : IdentityDbContext<Applicatio

我已将我的Asp.NET项目发布到Plesk,它已成功完成。 现在我需要使用PM更新数据库,但它会为“ASPNETROLES”创建表,然后抛出异常

指定的密钥太长;最大密钥长度为767字节

我找到了以下解决方案,但没有一个有效:

我已尝试以下代码,但失败:

[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class AppIdentityDbContext : IdentityDbContext<ApplicationUser>
{
    public AppIdentityDbContext() : base("myConnection")
    {

    }
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
        modelBuilder.Entity<HistoryRow>().HasKey<string>(h => h.MigrationId);
        modelBuilder.Entity<HistoryRow>().Property(h => h.MigrationId).HasMaxLength(100).IsRequired();
        modelBuilder.Entity<HistoryRow>().Property(h => h.ContextKey).HasMaxLength(200).IsRequired();
        modelBuilder.Entity<ApplicationUser>().Property(u => u.Id).HasMaxLength(128);
        modelBuilder.Entity<ApplicationUser>().Property(u => u.UserName).HasMaxLength(128);
        modelBuilder.Entity<ApplicationUser>().Property(u => u.Email).HasMaxLength(128);
        modelBuilder.Entity<IdentityRole>().Property(r => r.Name).HasMaxLength(128);

}
[DbConfigurationType(typeof(MySqlEFConfiguration))]
公共类AppIdentityDbContext:IdentityDbContext
{
public-AppIdentityDbContext():基(“myConnection”)
{
}
模型创建时受保护的覆盖无效(DbModelBuilder modelBuilder)
{
基于模型创建(modelBuilder);
modelBuilder.Entity().HasKey(h=>h.MigrationId);
modelBuilder.Entity().Property(h=>h.MigrationId).HasMaxLength(100).IsRequired();
modelBuilder.Entity().Property(h=>h.ContextKey).HasMaxLength(200).IsRequired();
modelBuilder.Entity().Property(u=>u.Id).HasMaxLength(128);
modelBuilder.Entity().Property(u=>u.UserName).HasMaxLength(128);
modelBuilder.Entity().Property(u=>u.Email).HasMaxLength(128);
modelBuilder.Entity().Property(r=>r.Name).HasMaxLength(128);
}
它应该创建所有ASPNET表,还应该将主键设置为自动递增

有人可以分享一个在Plesk上部署的指南吗