From 511718cfe7a4b275ff3815e1d42256d29bb43b02 Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Wed, 20 Mar 2019 17:29:09 +0300 Subject: [PATCH] Revised module references for the service template. Fixed #872. --- .../IdentityServerHost/DemoAppDbContext.cs | 6 + .../IdentityServerHost.csproj | 8 +- ....cs => 20190320142333_Initial.Designer.cs} | 299 +++++++++++++++++- ...1_Initial.cs => 20190320142333_Initial.cs} | 220 ++++++++++++- .../DemoAppDbContextModelSnapshot.cs | 297 ++++++++++++++++- .../host/IdentityServerHost/appsettings.json | 5 +- .../DemoAppDbContext.cs | 3 +- ....cs => 20190320142412_Initial.Designer.cs} | 2 +- ...9_Initial.cs => 20190320142412_Initial.cs} | 0 .../_CreateSqlServerCacheDatabase.bat | 2 +- .../appsettings.json | 9 +- 11 files changed, 791 insertions(+), 60 deletions(-) rename templates/service/host/IdentityServerHost/Migrations/{20190107114341_Initial.Designer.cs => 20190320142333_Initial.Designer.cs} (75%) rename templates/service/host/IdentityServerHost/Migrations/{20190107114341_Initial.cs => 20190320142333_Initial.cs} (77%) rename templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/{20190214093219_Initial.Designer.cs => 20190320142412_Initial.Designer.cs} (99%) rename templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/{20190214093219_Initial.cs => 20190320142412_Initial.cs} (100%) diff --git a/templates/service/host/IdentityServerHost/DemoAppDbContext.cs b/templates/service/host/IdentityServerHost/DemoAppDbContext.cs index 754cd89dff9..5d418a19e0a 100644 --- a/templates/service/host/IdentityServerHost/DemoAppDbContext.cs +++ b/templates/service/host/IdentityServerHost/DemoAppDbContext.cs @@ -1,7 +1,10 @@ using Microsoft.EntityFrameworkCore; +using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.IdentityServer.EntityFrameworkCore; +using Volo.Abp.PermissionManagement.EntityFrameworkCore; +using Volo.Abp.SettingManagement.EntityFrameworkCore; namespace IdentityServerHost { @@ -17,6 +20,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); + modelBuilder.ConfigurePermissionManagement(); + modelBuilder.ConfigureSettingManagement(); + modelBuilder.ConfigureAuditLogging(); modelBuilder.ConfigureIdentity(); modelBuilder.ConfigureIdentityServer(); } diff --git a/templates/service/host/IdentityServerHost/IdentityServerHost.csproj b/templates/service/host/IdentityServerHost/IdentityServerHost.csproj index c5b8c3826d5..7e72681de08 100644 --- a/templates/service/host/IdentityServerHost/IdentityServerHost.csproj +++ b/templates/service/host/IdentityServerHost/IdentityServerHost.csproj @@ -17,6 +17,9 @@ + + + @@ -26,9 +29,4 @@ - - - - - diff --git a/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.Designer.cs b/templates/service/host/IdentityServerHost/Migrations/20190320142333_Initial.Designer.cs similarity index 75% rename from templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.Designer.cs rename to templates/service/host/IdentityServerHost/Migrations/20190320142333_Initial.Designer.cs index 1dd595dfd15..8ef18c7e126 100644 --- a/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.Designer.cs +++ b/templates/service/host/IdentityServerHost/Migrations/20190320142333_Initial.Designer.cs @@ -10,7 +10,7 @@ namespace IdentityServerHost.Migrations { [DbContext(typeof(DemoAppDbContext))] - [Migration("20190107114341_Initial")] + [Migration("20190320142333_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -21,6 +21,202 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationName") + .HasColumnName("ApplicationName") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnName("BrowserInfo") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnName("ClientId") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnName("ClientIpAddress") + .HasMaxLength(64); + + b.Property("ClientName") + .HasColumnName("ClientName") + .HasMaxLength(128); + + b.Property("Comments") + .HasColumnName("Comments") + .HasMaxLength(256); + + b.Property("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasColumnName("CorrelationId") + .HasMaxLength(64); + + b.Property("Exceptions") + .HasColumnName("Exceptions") + .HasMaxLength(4000); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasColumnName("HttpMethod") + .HasMaxLength(16); + + b.Property("HttpStatusCode") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.Property("Url") + .HasColumnName("Url") + .HasMaxLength(256); + + b.Property("UserId") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasColumnName("UserName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasColumnName("MethodName") + .HasMaxLength(128); + + b.Property("Parameters") + .HasColumnName("Parameters") + .HasMaxLength(2000); + + b.Property("ServiceName") + .HasColumnName("ServiceName") + .HasMaxLength(256); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasColumnName("EntityId") + .HasMaxLength(128); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasColumnName("EntityTypeFullName") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EntityChangeId"); + + b.Property("NewValue") + .HasColumnName("NewValue") + .HasMaxLength(512); + + b.Property("OriginalValue") + .HasColumnName("OriginalValue") + .HasMaxLength(512); + + b.Property("PropertyName") + .IsRequired() + .HasColumnName("PropertyName") + .HasMaxLength(128); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") @@ -445,7 +641,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("BackChannelLogoutSessionRequired"); b.Property("BackChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("ClientClaimsPrefix") .HasMaxLength(200); @@ -458,7 +654,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("ConcurrencyStamp"); @@ -477,14 +673,14 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("FrontChannelLogoutSessionRequired"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("IdentityTokenLifetime"); b.Property("IncludeJwtId"); b.Property("LogoUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("PairWiseSubjectSalt") .HasMaxLength(200); @@ -517,22 +713,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("Id") - .ValueGeneratedOnAdd(); - b.Property("ClientId"); b.Property("Type") - .IsRequired() .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasMaxLength(250); - b.HasKey("Id"); - - b.HasIndex("ClientId"); + b.HasKey("ClientId", "Type", "Value"); b.ToTable("IdentityServerClientClaims"); }); @@ -578,7 +767,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ClientId"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(2000); + .HasMaxLength(200); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -590,11 +779,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ClientId"); b.Property("Key") - .HasMaxLength(250); + .HasMaxLength(64); b.Property("Value") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(128); b.HasKey("ClientId", "Key"); @@ -606,7 +795,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ClientId"); b.Property("RedirectUri") - .HasMaxLength(2000); + .HasMaxLength(200); b.HasKey("ClientId", "RedirectUri"); @@ -727,6 +916,82 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("IdentityServerIdentityResources"); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog") + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog") + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange") + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.HasOne("Volo.Abp.Identity.IdentityRole") diff --git a/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.cs b/templates/service/host/IdentityServerHost/Migrations/20190320142333_Initial.cs similarity index 77% rename from templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.cs rename to templates/service/host/IdentityServerHost/Migrations/20190320142333_Initial.cs index ddb2f14c1cc..88588fb9704 100644 --- a/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.cs +++ b/templates/service/host/IdentityServerHost/Migrations/20190320142333_Initial.cs @@ -7,6 +7,37 @@ public partial class Initial : Migration { protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.CreateTable( + name: "AbpAuditLogs", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + ApplicationName = table.Column(maxLength: 96, nullable: true), + UserId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: true), + TenantId = table.Column(nullable: true), + ImpersonatorUserId = table.Column(nullable: true), + ImpersonatorTenantId = table.Column(nullable: true), + ExecutionTime = table.Column(nullable: false), + ExecutionDuration = table.Column(nullable: false), + ClientIpAddress = table.Column(maxLength: 64, nullable: true), + ClientName = table.Column(maxLength: 128, nullable: true), + ClientId = table.Column(maxLength: 64, nullable: true), + CorrelationId = table.Column(maxLength: 64, nullable: true), + BrowserInfo = table.Column(maxLength: 512, nullable: true), + HttpMethod = table.Column(maxLength: 16, nullable: true), + Url = table.Column(maxLength: 256, nullable: true), + Exceptions = table.Column(maxLength: 4000, nullable: true), + Comments = table.Column(maxLength: 256, nullable: true), + HttpStatusCode = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpClaimTypes", columns: table => new @@ -27,6 +58,21 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpPermissionGrants", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 128, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: false), + ProviderKey = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpRoles", columns: table => new @@ -46,6 +92,21 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_AbpRoles", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpSettings", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(maxLength: 2048, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: true), + ProviderKey = table.Column(maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSettings", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpUsers", columns: table => new @@ -109,8 +170,8 @@ protected override void Up(MigrationBuilder migrationBuilder) ClientId = table.Column(maxLength: 200, nullable: false), ClientName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), + ClientUri = table.Column(maxLength: 300, nullable: true), + LogoUri = table.Column(maxLength: 300, nullable: true), Enabled = table.Column(nullable: false), ProtocolType = table.Column(maxLength: 200, nullable: false), RequireClientSecret = table.Column(nullable: false), @@ -120,9 +181,9 @@ protected override void Up(MigrationBuilder migrationBuilder) RequirePkce = table.Column(nullable: false), AllowPlainTextPkce = table.Column(nullable: false), AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), + FrontChannelLogoutUri = table.Column(maxLength: 300, nullable: true), FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), + BackChannelLogoutUri = table.Column(maxLength: 300, nullable: true), BackChannelLogoutSessionRequired = table.Column(nullable: false), AllowOfflineAccess = table.Column(nullable: false), IdentityTokenLifetime = table.Column(nullable: false), @@ -186,6 +247,55 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); }); + migrationBuilder.CreateTable( + name: "AbpAuditLogActions", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + AuditLogId = table.Column(nullable: false), + ServiceName = table.Column(maxLength: 256, nullable: true), + MethodName = table.Column(maxLength: 128, nullable: true), + Parameters = table.Column(maxLength: 2000, nullable: true), + ExecutionTime = table.Column(nullable: false), + ExecutionDuration = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); + table.ForeignKey( + name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityChanges", + columns: table => new + { + Id = table.Column(nullable: false), + AuditLogId = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ChangeTime = table.Column(nullable: false), + ChangeType = table.Column(nullable: false), + EntityId = table.Column(maxLength: 128, nullable: false), + EntityTypeFullName = table.Column(maxLength: 128, nullable: false), + ExtraProperties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpRoleClaims", columns: table => new @@ -361,14 +471,13 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IdentityServerClientClaims", columns: table => new { - Id = table.Column(nullable: false), ClientId = table.Column(nullable: false), Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 250, nullable: false) }, constraints: table => { - table.PrimaryKey("PK_IdentityServerClientClaims", x => x.Id); + table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); table.ForeignKey( name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", column: x => x.ClientId, @@ -436,7 +545,7 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) + PostLogoutRedirectUri = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -454,8 +563,8 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) + Key = table.Column(maxLength: 64, nullable: false), + Value = table.Column(maxLength: 128, nullable: false) }, constraints: table => { @@ -473,7 +582,7 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 2000, nullable: false) + RedirectUri = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -543,6 +652,29 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpEntityPropertyChanges", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + EntityChangeId = table.Column(nullable: false), + NewValue = table.Column(maxLength: 512, nullable: true), + OriginalValue = table.Column(maxLength: 512, nullable: true), + PropertyName = table.Column(maxLength: 128, nullable: false), + PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", + column: x => x.EntityChangeId, + principalTable: "AbpEntityChanges", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "IdentityServerApiScopeClaims", columns: table => new @@ -562,6 +694,46 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_AuditLogId", + table: "AbpAuditLogActions", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", + table: "AbpAuditLogActions", + columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "UserId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_AuditLogId", + table: "AbpEntityChanges", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", + table: "AbpEntityChanges", + columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityPropertyChanges_EntityChangeId", + table: "AbpEntityPropertyChanges", + column: "EntityChangeId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + table: "AbpPermissionGrants", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", table: "AbpRoleClaims", @@ -572,6 +744,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "AbpRoles", column: "NormalizedName"); + migrationBuilder.CreateIndex( + name: "IX_AbpSettings_Name_ProviderName_ProviderKey", + table: "AbpSettings", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + migrationBuilder.CreateIndex( name: "IX_AbpUserClaims_UserId", table: "AbpUserClaims", @@ -607,11 +784,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "AbpUsers", column: "UserName"); - migrationBuilder.CreateIndex( - name: "IX_IdentityServerClientClaims_ClientId", - table: "IdentityServerClientClaims", - column: "ClientId"); - migrationBuilder.CreateIndex( name: "IX_IdentityServerClients_ClientId", table: "IdentityServerClients", @@ -626,12 +798,24 @@ protected override void Up(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "AbpAuditLogActions"); + migrationBuilder.DropTable( name: "AbpClaimTypes"); + migrationBuilder.DropTable( + name: "AbpEntityPropertyChanges"); + + migrationBuilder.DropTable( + name: "AbpPermissionGrants"); + migrationBuilder.DropTable( name: "AbpRoleClaims"); + migrationBuilder.DropTable( + name: "AbpSettings"); + migrationBuilder.DropTable( name: "AbpUserClaims"); @@ -686,6 +870,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "IdentityServerPersistedGrants"); + migrationBuilder.DropTable( + name: "AbpEntityChanges"); + migrationBuilder.DropTable( name: "AbpRoles"); @@ -701,6 +888,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "IdentityServerIdentityResources"); + migrationBuilder.DropTable( + name: "AbpAuditLogs"); + migrationBuilder.DropTable( name: "IdentityServerApiResources"); } diff --git a/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs b/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs index 2a102778eef..1aec48ea057 100644 --- a/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs +++ b/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs @@ -19,6 +19,202 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationName") + .HasColumnName("ApplicationName") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnName("BrowserInfo") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnName("ClientId") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnName("ClientIpAddress") + .HasMaxLength(64); + + b.Property("ClientName") + .HasColumnName("ClientName") + .HasMaxLength(128); + + b.Property("Comments") + .HasColumnName("Comments") + .HasMaxLength(256); + + b.Property("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasColumnName("CorrelationId") + .HasMaxLength(64); + + b.Property("Exceptions") + .HasColumnName("Exceptions") + .HasMaxLength(4000); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasColumnName("HttpMethod") + .HasMaxLength(16); + + b.Property("HttpStatusCode") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.Property("Url") + .HasColumnName("Url") + .HasMaxLength(256); + + b.Property("UserId") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasColumnName("UserName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasColumnName("MethodName") + .HasMaxLength(128); + + b.Property("Parameters") + .HasColumnName("Parameters") + .HasMaxLength(2000); + + b.Property("ServiceName") + .HasColumnName("ServiceName") + .HasMaxLength(256); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasColumnName("EntityId") + .HasMaxLength(128); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasColumnName("EntityTypeFullName") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EntityChangeId"); + + b.Property("NewValue") + .HasColumnName("NewValue") + .HasMaxLength(512); + + b.Property("OriginalValue") + .HasColumnName("OriginalValue") + .HasMaxLength(512); + + b.Property("PropertyName") + .IsRequired() + .HasColumnName("PropertyName") + .HasMaxLength(128); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") @@ -443,7 +639,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("BackChannelLogoutSessionRequired"); b.Property("BackChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("ClientClaimsPrefix") .HasMaxLength(200); @@ -456,7 +652,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("ConcurrencyStamp"); @@ -475,14 +671,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FrontChannelLogoutSessionRequired"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("IdentityTokenLifetime"); b.Property("IncludeJwtId"); b.Property("LogoUri") - .HasMaxLength(2000); + .HasMaxLength(300); b.Property("PairWiseSubjectSalt") .HasMaxLength(200); @@ -515,22 +711,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("Id") - .ValueGeneratedOnAdd(); - b.Property("ClientId"); b.Property("Type") - .IsRequired() .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasMaxLength(250); - b.HasKey("Id"); - - b.HasIndex("ClientId"); + b.HasKey("ClientId", "Type", "Value"); b.ToTable("IdentityServerClientClaims"); }); @@ -576,7 +765,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ClientId"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(2000); + .HasMaxLength(200); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -588,11 +777,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ClientId"); b.Property("Key") - .HasMaxLength(250); + .HasMaxLength(64); b.Property("Value") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(128); b.HasKey("ClientId", "Key"); @@ -604,7 +793,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ClientId"); b.Property("RedirectUri") - .HasMaxLength(2000); + .HasMaxLength(200); b.HasKey("ClientId", "RedirectUri"); @@ -725,6 +914,82 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("IdentityServerIdentityResources"); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog") + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog") + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange") + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.HasOne("Volo.Abp.Identity.IdentityRole") diff --git a/templates/service/host/IdentityServerHost/appsettings.json b/templates/service/host/IdentityServerHost/appsettings.json index 6e801d256df..98a4b98d4ba 100644 --- a/templates/service/host/IdentityServerHost/appsettings.json +++ b/templates/service/host/IdentityServerHost/appsettings.json @@ -1,6 +1,7 @@ { "ConnectionStrings": { - "Default": "Server=localhost;Database=IdentityServerHost;Trusted_Connection=True;MultipleActiveResultSets=true", - "SqlServerCache": "Server=localhost;Database=MyProjectNameCache;Trusted_Connection=True;MultipleActiveResultSets=true" + "Default": "Server=localhost;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", + + "SqlServerCache": "Server=localhost;Database=MyProjectName_Cache;Trusted_Connection=True;MultipleActiveResultSets=true" } } \ No newline at end of file diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs b/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs index 1b3540e00ba..ab9cad5293e 100644 --- a/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs +++ b/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs @@ -21,8 +21,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.ConfigurePermissionManagement(); modelBuilder.ConfigureSettingManagement(); - modelBuilder.ConfigureMyProjectName(); modelBuilder.ConfigureAuditLogging(); + + modelBuilder.ConfigureMyProjectName(); } } } diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190214093219_Initial.Designer.cs b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190320142412_Initial.Designer.cs similarity index 99% rename from templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190214093219_Initial.Designer.cs rename to templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190320142412_Initial.Designer.cs index ee67505ed57..423eb1cb0a0 100644 --- a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190214093219_Initial.Designer.cs +++ b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190320142412_Initial.Designer.cs @@ -10,7 +10,7 @@ namespace MyCompanyName.MyProjectName.Host.Migrations { [DbContext(typeof(DemoAppDbContext))] - [Migration("20190214093219_Initial")] + [Migration("20190320142412_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190214093219_Initial.cs b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190320142412_Initial.cs similarity index 100% rename from templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190214093219_Initial.cs rename to templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190320142412_Initial.cs diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/_CreateSqlServerCacheDatabase.bat b/templates/service/host/MyCompanyName.MyProjectName.Host/_CreateSqlServerCacheDatabase.bat index 6b8b9d7060a..927f8a72d71 100644 --- a/templates/service/host/MyCompanyName.MyProjectName.Host/_CreateSqlServerCacheDatabase.bat +++ b/templates/service/host/MyCompanyName.MyProjectName.Host/_CreateSqlServerCacheDatabase.bat @@ -1 +1 @@ -dotnet sql-cache create "Server=localhost;Database=MyProjectNameCache;Trusted_Connection=True;MultipleActiveResultSets=true" dbo TestCache \ No newline at end of file +dotnet sql-cache create "Server=localhost;Database=MyProjectName_Cache;Trusted_Connection=True;MultipleActiveResultSets=true" dbo TestCache \ No newline at end of file diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/appsettings.json b/templates/service/host/MyCompanyName.MyProjectName.Host/appsettings.json index 76dc222001c..a09353bfef5 100644 --- a/templates/service/host/MyCompanyName.MyProjectName.Host/appsettings.json +++ b/templates/service/host/MyCompanyName.MyProjectName.Host/appsettings.json @@ -1,6 +1,11 @@ { "ConnectionStrings": { - "Default": "Server=localhost;Database=MyProjectNameHost;Trusted_Connection=True;MultipleActiveResultSets=true", - "SqlServerCache": "Server=localhost;Database=MyProjectNameCache;Trusted_Connection=True;MultipleActiveResultSets=true" + "Default": "Server=localhost;Database=MyProjectName_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true", + + "AbpSettingManagement": "Server=localhost;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", + "AbpPermissionManagement": "Server=localhost;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", + "AbpAuditLogging": "Server=localhost;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", + + "SqlServerCache": "Server=localhost;Database=MyProjectName_Cache;Trusted_Connection=True;MultipleActiveResultSets=true" } } \ No newline at end of file