Reputation: 2282
I have an application built with asp.net-core 2.0
.
I used Pomelo.EntityFrameworkCore.MySql
to integrate MySql.
The configuration which I use in Startup.cs is:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options => options.UseMySql("Server=localhost;port=3306;database=MyDB;user=MyDb_user;password=test123");
...
}
The DbContext
for ApplicationUser
which comes with the framework looks like:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Customize the ASP.NET Identity model and override the defaults if needed.
// For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder);
}
}
Now in MySql I created MyDB with Collation "utf8_general_ci".
But on DB migrate I am getting the error:
'Specified key was too long; max key length is 1000 bytes'
All solutions which I found to get this working with utf8 doesn't work with asp.net-core 2.0
Is there any solution for this with asp.net-core 2.0
Upvotes: 2
Views: 1454
Reputation: 21
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("SET default_storage_engine=INNODB");
}
Ability to specify engine, charset, ROW_FORMAT and more
Upvotes: 2