skoruba / Duende.IdentityServer.Admin

The administration for the Duende IdentityServer and Asp.Net Core Identity ⚡
Apache License 2.0
572 stars 195 forks source link

ASP.NET Identity table names #107

Closed apetrut closed 1 month ago

apetrut commented 1 year ago

Hi @skoruba ,

After I installed and used the VS template I noticed that the ASP.NET Identity tables have changed compared to the original ones.

AspNetUsers -> Users AspNetRoles -> Roles ... etc

image

Our client needs to migrate an existing database where the users are stored in an Identity table with the original table names. Given that your solution has different names for tables I am trying to estimate the effort I would need to make in order to do the migration correctly.

Can you confirm why was this renaming needed and is there a way I can preserve the tables with original names?

Regards, Andrei

eminmesic commented 1 year ago

@apetrut you can change it by yourself in TableConsts file.

Check out this file: https://github.com/skoruba/Duende.IdentityServer.Admin/blob/main/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Constants/TableConsts.cs

You can see during the configuration of identity context (link below) they are using names from TableConsts. All in all everything is configured in Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared project. https://github.com/skoruba/Duende.IdentityServer.Admin/blob/main/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/DbContexts/AdminIdentityDbContext.cs

apetrut commented 1 year ago

@eminmesic Thanks, it's really great that the table names are customizable.

apetrut commented 1 month ago

@skoruba I have recently taken version 2.3.0 which loads the table names from the configuration file. I have renamed the fields in configuration to use the AspNet* prefix but the tables were created with the old names. Can you reproduce that?

skoruba commented 1 month ago

Hi @apetrut - yes, you can rename tables, but you need re-generate ef migrations.