dotnet / dotnet/aspnetcore

EF Core migration not correctly applied to app.db included with Blazor auth template

Open
#64,673 3 comments 0 reactions 0 assignees View on GitHub
area-identity bug
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

It seems that the EF Core migration for the identity schema hasn't been correctly applied to the app.db that we generate with the Blazor Web App template when auth with ASP.NET Core Identity is enabled. If you try to update the database using the template included migration you get an error that the identity tables are already there.

Repro steps:

- Install .NET 10 SDK
- `dotnet tool install --global dotnet-ef`
- `dotnet new blazor -au Individual`
- `dotnet ef database update`

Expected result: Updating the database works without errors
Actual result: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'table "AspNetRoles" already exists'.
Workaround:

- Delete the app.db that comes with the template.
- Run `dotnet ef database update` to regenerate it.
- Running `dotnet ef database update` again succeeds without error.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.