Skip to content

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

@danroth27

Description

@danroth27

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions