diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs similarity index 97% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs index e3441488a9..ee4de4f358 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20200706091528_Initial")] + [Migration("20200707050900_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -863,6 +863,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => { b.Property("Id") @@ -928,14 +947,14 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerApiResources"); }); @@ -981,8 +1000,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1076,15 +1095,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - b.Property("Type") .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.HasKey("ApiScopeId", "Name", "Type"); + b.HasKey("ApiScopeId", "Type"); b.ToTable("IdentityServerApiScopeClaims"); }); @@ -1426,8 +1441,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1468,7 +1483,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("DeviceCode") .IsRequired() @@ -1484,7 +1500,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1502,8 +1519,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Expiration"); - b.HasIndex("UserCode") - .IsUnique(); + b.HasIndex("UserCode"); b.ToTable("IdentityServerDeviceFlowCodes"); }); @@ -1537,7 +1553,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1550,7 +1567,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1567,6 +1585,8 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("IdentityServerPersistedGrants"); }); @@ -1937,6 +1957,15 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => { b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs similarity index 96% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs index 36c8079aa1..48726d777b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs @@ -250,8 +250,7 @@ namespace MyCompanyName.MyProjectName.Migrations Description = table.Column(maxLength: 1000, nullable: true), Enabled = table.Column(nullable: false), AllowedAccessTokenSigningAlgorithms = table.Column(nullable: true), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) + ShowInDiscoveryDocument = table.Column(nullable: false) }, constraints: table => { @@ -356,9 +355,9 @@ namespace MyCompanyName.MyProjectName.Migrations DeviceCode = table.Column(maxLength: 200, nullable: false), UserCode = table.Column(maxLength: 200, nullable: false), SubjectId = table.Column(maxLength: 200, nullable: true), - SessionId = table.Column(nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), ClientId = table.Column(maxLength: 200, nullable: false), - Description = table.Column(nullable: true), + Description = table.Column(maxLength: 200, nullable: true), Expiration = table.Column(nullable: false), Data = table.Column(maxLength: 50000, nullable: false) }, @@ -404,9 +403,9 @@ namespace MyCompanyName.MyProjectName.Migrations ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), Type = table.Column(maxLength: 50, nullable: false), SubjectId = table.Column(maxLength: 200, nullable: true), - SessionId = table.Column(nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), ClientId = table.Column(maxLength: 200, nullable: false), - Description = table.Column(nullable: true), + Description = table.Column(maxLength: 200, nullable: true), CreationTime = table.Column(nullable: false), Expiration = table.Column(nullable: true), ConsumedTime = table.Column(nullable: true), @@ -667,6 +666,25 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "IdentityServerApiResourceProperties", + columns: table => new + { + ApiResourceId = table.Column(nullable: false), + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key }); + table.ForeignKey( + name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "IdentityServerApiResourceScopes", columns: table => new @@ -692,7 +710,7 @@ namespace MyCompanyName.MyProjectName.Migrations Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 4000, nullable: false), ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -711,12 +729,11 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Type = table.Column(maxLength: 200, nullable: false), - ApiScopeId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) + ApiScopeId = table.Column(nullable: false) }, constraints: table => { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Name, x.Type }); + table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Type }); table.ForeignKey( name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScopeId", column: x => x.ApiScopeId, @@ -897,7 +914,7 @@ namespace MyCompanyName.MyProjectName.Migrations Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 4000, nullable: false), ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -1096,6 +1113,12 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpUsers", column: "UserName"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerApiResources_Name", + table: "IdentityServerApiResources", + column: "Name", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerApiScopes_Name", table: "IdentityServerApiScopes", @@ -1121,8 +1144,7 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_IdentityServerDeviceFlowCodes_UserCode", table: "IdentityServerDeviceFlowCodes", - column: "UserCode", - unique: true); + column: "UserCode"); migrationBuilder.CreateIndex( name: "IX_IdentityServerIdentityResources_Name", @@ -1139,6 +1161,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", table: "IdentityServerPersistedGrants", columns: new[] { "SubjectId", "ClientId", "Type" }); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type", + table: "IdentityServerPersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) @@ -1191,6 +1218,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "IdentityServerApiResourceClaims"); + migrationBuilder.DropTable( + name: "IdentityServerApiResourceProperties"); + migrationBuilder.DropTable( name: "IdentityServerApiResourceScopes"); 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 3e52c652ed..bfcb19749d 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 @@ -861,6 +861,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => { b.Property("Id") @@ -926,14 +945,14 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerApiResources"); }); @@ -979,8 +998,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1074,15 +1093,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - b.Property("Type") .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.HasKey("ApiScopeId", "Name", "Type"); + b.HasKey("ApiScopeId", "Type"); b.ToTable("IdentityServerApiScopeClaims"); }); @@ -1424,8 +1439,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1466,7 +1481,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("DeviceCode") .IsRequired() @@ -1482,7 +1498,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1500,8 +1517,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Expiration"); - b.HasIndex("UserCode") - .IsUnique(); + b.HasIndex("UserCode"); b.ToTable("IdentityServerDeviceFlowCodes"); }); @@ -1535,7 +1551,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1548,7 +1565,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1565,6 +1583,8 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("IdentityServerPersistedGrants"); }); @@ -1935,6 +1955,15 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => { b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null)