Open jonasarcangel opened 3 years ago
Try changing your migration file manually:
migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column<string>(nullable: false),
Change it to
Id = table.Column<string>(nullable: false, maxLength: 450)
@blowdart FYI
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
@jonasarcangel I created a sample template to solve this problem https://github.com/mahomedalid/blazor-auth-mysql you probably can use this https://github.com/mahomedalid/blazor-auth-mysql/blob/main/Data/Migrations/00000000000000_CreateIdentitySchema.cs
I would like to work in this issue, I'm working in a PR to add a new option, with the following characteristics:
I think this should be important, because it helps new developers into Blazor to setup a quick boilerplate/project to use with some of the most open-source tools. I can see this as a great help and introduction for LAMP (Linux/Apache/MySQL/PHP) developers and will likely attract new users. I also see this as a start to add support for other databases like PostgreSQL.
@mkArtakMSFT @msftbot Let me know what you think.
I had this issue creating a .NET 8 Blazor identity project, configured it with .NET Aspire, and connected it with the .NET Aspire MySQL Entity Framework component.
I tried to overwrite the model definition with ApplicationDbContext, and re-generated the migration code. Migrations still failed.
@mahomedalid - thanks for your template updates! Copying the migrations files from your repo fixed it for me. Looking at the differences, it looks like changing maxlength alone is not enough. Your templates also changed the type from TEXT to varchar(256).
@mkArtakMSFT - I think after the release of .NET Aspire, more people will have this issue, and the label affected-few probably no longer applies.
Using ASP.Net Core Identity and EntityFramework, the migration code generated created key (for tables like ApplicationUser, from IdentityUser) with Id and no key length.
Getting an error when running with MySql:
For example: