diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index ac33dc9596..2c722f58ab 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -52,7 +52,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore client.HasMany(x => x.Claims).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); client.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); - client.HasIndex(x => x.ClientId).IsUnique(); + client.HasIndex(x => x.ClientId); }); builder.Entity(grantType => @@ -173,8 +173,6 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore s => JsonConvert.DeserializeObject>(s) ); - identityResource.HasAlternateKey(x => x.Name); - identityResource.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired(); }); @@ -202,8 +200,6 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore s => JsonConvert.DeserializeObject>(s) ); - apiResource.HasAlternateKey(x => x.Name); - apiResource.HasMany(x => x.Secrets).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); apiResource.HasMany(x => x.Scopes).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); apiResource.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190910115959_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.Designer.cs similarity index 99% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190910115959_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.Designer.cs index 1fd604d339..2827fc559d 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190910115959_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.Designer.cs @@ -10,7 +10,7 @@ using MyCompanyName.MyProjectName.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20190910115959_Initial")] + [Migration("20190918061142_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -640,8 +640,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasAlternateKey("Name"); - b.ToTable("IdentityServerApiResources"); }); @@ -840,8 +838,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); @@ -1075,8 +1072,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasAlternateKey("Name"); - b.ToTable("IdentityServerIdentityResources"); }); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190910115959_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.cs similarity index 99% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190910115959_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.cs index cb7e294ea1..85fe9bcb90 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190910115959_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.cs @@ -224,7 +224,6 @@ namespace MyCompanyName.MyProjectName.Migrations constraints: table => { table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); - table.UniqueConstraint("AK_IdentityServerApiResources_Name", x => x.Name); }); migrationBuilder.CreateTable( @@ -310,7 +309,6 @@ namespace MyCompanyName.MyProjectName.Migrations constraints: table => { table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); - table.UniqueConstraint("AK_IdentityServerIdentityResources_Name", x => x.Name); }); migrationBuilder.CreateTable( @@ -909,8 +907,7 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_IdentityServerClients_ClientId", table: "IdentityServerClients", - column: "ClientId", - unique: true); + column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index b7b82e62a1..3df2d974de 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -638,8 +638,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasAlternateKey("Name"); - b.ToTable("IdentityServerApiResources"); }); @@ -838,8 +836,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); @@ -1073,8 +1070,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasAlternateKey("Name"); - b.ToTable("IdentityServerIdentityResources"); }); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj index 32d39bedaa..eed0f85e08 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj @@ -10,6 +10,8 @@ + +