diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs index 084e677214..204bab0816 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore b.Property(x => x.ProviderName).HasMaxLength(FeatureValueConsts.MaxProviderNameLength); b.Property(x => x.ProviderKey).HasMaxLength(FeatureValueConsts.MaxProviderKeyLength); - b.HasIndex(x => new { x.Name, x.ProviderName, x.ProviderKey }); + b.HasIndex(x => new { x.Name, x.ProviderName, x.ProviderKey }).IsUnique(true); b.ApplyObjectExtensionMappings(); }); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs index ad94e914b5..77dd103132 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity public TestPermissionDataBuilder( IGuidGenerator guidGenerator, IIdentityUserRepository userRepository, - IPermissionGrantRepository permissionGrantRepository, + IPermissionGrantRepository permissionGrantRepository, ILookupNormalizer lookupNormalizer) { _guidGenerator = guidGenerator; @@ -35,10 +35,6 @@ namespace Volo.Abp.Identity private async Task AddRolePermissions() { - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "admin"); - await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "admin"); - await AddPermission(TestPermissionNames.MyPermission2_ChildPermission1, RolePermissionValueProvider.ProviderName, "admin"); - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "moderator"); await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "moderator"); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs index 100143e033..8e44de8bfe 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore b.Property(x => x.ProviderName).HasMaxLength(PermissionGrantConsts.MaxProviderNameLength).IsRequired(); b.Property(x => x.ProviderKey).HasMaxLength(PermissionGrantConsts.MaxProviderKeyLength).IsRequired(); - b.HasIndex(x => new {x.Name, x.ProviderName, x.ProviderKey}); + b.HasIndex(x => new {x.TenantId, x.Name, x.ProviderName, x.ProviderKey}).IsUnique(true); b.ApplyObjectExtensionMappings(); }); diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs index aafc18f8de..b01f4bc29f 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore b.Property(x => x.ProviderName).HasMaxLength(SettingConsts.MaxProviderNameLength); b.Property(x => x.ProviderKey).HasMaxLength(SettingConsts.MaxProviderKeyLength); - b.HasIndex(x => new {x.Name, x.ProviderName, x.ProviderKey}); + b.HasIndex(x => new {x.Name, x.ProviderName, x.ProviderKey}).IsUnique(true); b.ApplyObjectExtensionMappings(); }); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210909052638_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.Designer.cs similarity index 96% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210909052638_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.Designer.cs index fa24bfe18c..3fbc96c898 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210909052638_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.Designer.cs @@ -8,10 +8,12 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20210909052638_Initial")] + [Migration("20211105125915_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -19,9 +21,10 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -128,7 +131,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -178,7 +181,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -228,7 +231,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -270,7 +273,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => @@ -328,7 +331,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("IsAbandoned", "NextTryTime"); - b.ToTable("AbpBackgroundJobs"); + b.ToTable("AbpBackgroundJobs", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -357,15 +360,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -406,13 +410,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("SourceTenantId") @@ -433,13 +436,12 @@ namespace MyCompanyName.MyProjectName.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -482,7 +484,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -510,13 +512,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Action") @@ -585,13 +586,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") @@ -740,7 +740,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -768,7 +768,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -797,7 +797,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -824,7 +824,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -843,7 +843,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -868,13 +868,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Code") @@ -942,7 +941,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -969,7 +968,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => @@ -1043,7 +1042,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiResources"); + b.ToTable("IdentityServerApiResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => @@ -1057,7 +1056,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type"); - b.ToTable("IdentityServerApiResourceClaims"); + b.ToTable("IdentityServerApiResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => @@ -1075,7 +1074,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Key", "Value"); - b.ToTable("IdentityServerApiResourceProperties"); + b.ToTable("IdentityServerApiResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => @@ -1089,7 +1088,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Scope"); - b.ToTable("IdentityServerApiResourceScopes"); + b.ToTable("IdentityServerApiResourceScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => @@ -1114,7 +1113,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type", "Value"); - b.ToTable("IdentityServerApiResourceSecrets"); + b.ToTable("IdentityServerApiResourceSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => @@ -1190,7 +1189,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiScopes"); + b.ToTable("IdentityServerApiScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => @@ -1204,7 +1203,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Type"); - b.ToTable("IdentityServerApiScopeClaims"); + b.ToTable("IdentityServerApiScopeClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => @@ -1222,7 +1221,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Key", "Value"); - b.ToTable("IdentityServerApiScopeProperties"); + b.ToTable("IdentityServerApiScopeProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => @@ -1406,7 +1405,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ClientId"); - b.ToTable("IdentityServerClients"); + b.ToTable("IdentityServerClients", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => @@ -1424,7 +1423,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientClaims"); + b.ToTable("IdentityServerClientClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => @@ -1438,7 +1437,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Origin"); - b.ToTable("IdentityServerClientCorsOrigins"); + b.ToTable("IdentityServerClientCorsOrigins", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => @@ -1452,7 +1451,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "GrantType"); - b.ToTable("IdentityServerClientGrantTypes"); + b.ToTable("IdentityServerClientGrantTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => @@ -1466,7 +1465,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Provider"); - b.ToTable("IdentityServerClientIdPRestrictions"); + b.ToTable("IdentityServerClientIdPRestrictions", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => @@ -1480,7 +1479,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "PostLogoutRedirectUri"); - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + b.ToTable("IdentityServerClientPostLogoutRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => @@ -1498,7 +1497,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Key", "Value"); - b.ToTable("IdentityServerClientProperties"); + b.ToTable("IdentityServerClientProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => @@ -1512,7 +1511,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "RedirectUri"); - b.ToTable("IdentityServerClientRedirectUris"); + b.ToTable("IdentityServerClientRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => @@ -1526,7 +1525,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Scope"); - b.ToTable("IdentityServerClientScopes"); + b.ToTable("IdentityServerClientScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => @@ -1551,7 +1550,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientSecrets"); + b.ToTable("IdentityServerClientSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => @@ -1623,7 +1622,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserCode"); - b.ToTable("IdentityServerDeviceFlowCodes"); + b.ToTable("IdentityServerDeviceFlowCodes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => @@ -1689,7 +1688,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "SessionId", "Type"); - b.ToTable("IdentityServerPersistedGrants"); + b.ToTable("IdentityServerPersistedGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => @@ -1765,7 +1764,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerIdentityResources"); + b.ToTable("IdentityServerIdentityResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => @@ -1779,7 +1778,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Type"); - b.ToTable("IdentityServerIdentityResourceClaims"); + b.ToTable("IdentityServerIdentityResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => @@ -1797,7 +1796,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Key", "Value"); - b.ToTable("IdentityServerIdentityResourceProperties"); + b.ToTable("IdentityServerIdentityResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -1827,9 +1826,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -1858,15 +1859,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -1918,7 +1920,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1937,7 +1939,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210909052638_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.cs similarity index 99% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210909052638_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.cs index 8e2d7527d5..e55b554b12 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210909052638_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.cs @@ -1,6 +1,8 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { public partial class Initial : Migration @@ -136,8 +138,7 @@ namespace MyCompanyName.MyProjectName.Migrations name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", column: x => x.ParentId, principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -1073,7 +1074,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", table: "AbpFeatureValues", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", @@ -1098,9 +1101,11 @@ namespace MyCompanyName.MyProjectName.Migrations column: "ParentId"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + name: "IX_AbpPermissionGrants_TenantId_Name_ProviderName_ProviderKey", table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "TenantId", "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -1135,7 +1140,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_AbpSettings_Name_ProviderName_ProviderKey", table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs index 928c1b96eb..bcb639b0cb 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameDbContext))] @@ -17,9 +19,10 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -126,7 +129,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -176,7 +179,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -226,7 +229,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -268,7 +271,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => @@ -326,7 +329,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("IsAbandoned", "NextTryTime"); - b.ToTable("AbpBackgroundJobs"); + b.ToTable("AbpBackgroundJobs", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -355,15 +358,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -404,13 +408,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("SourceTenantId") @@ -431,13 +434,12 @@ namespace MyCompanyName.MyProjectName.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -480,7 +482,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -508,13 +510,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Action") @@ -583,13 +584,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") @@ -738,7 +738,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -766,7 +766,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -795,7 +795,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -822,7 +822,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -841,7 +841,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -866,13 +866,12 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Code") @@ -940,7 +939,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -967,7 +966,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => @@ -1041,7 +1040,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiResources"); + b.ToTable("IdentityServerApiResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => @@ -1055,7 +1054,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type"); - b.ToTable("IdentityServerApiResourceClaims"); + b.ToTable("IdentityServerApiResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => @@ -1073,7 +1072,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Key", "Value"); - b.ToTable("IdentityServerApiResourceProperties"); + b.ToTable("IdentityServerApiResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => @@ -1087,7 +1086,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Scope"); - b.ToTable("IdentityServerApiResourceScopes"); + b.ToTable("IdentityServerApiResourceScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => @@ -1112,7 +1111,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type", "Value"); - b.ToTable("IdentityServerApiResourceSecrets"); + b.ToTable("IdentityServerApiResourceSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => @@ -1188,7 +1187,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiScopes"); + b.ToTable("IdentityServerApiScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => @@ -1202,7 +1201,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Type"); - b.ToTable("IdentityServerApiScopeClaims"); + b.ToTable("IdentityServerApiScopeClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => @@ -1220,7 +1219,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Key", "Value"); - b.ToTable("IdentityServerApiScopeProperties"); + b.ToTable("IdentityServerApiScopeProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => @@ -1404,7 +1403,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ClientId"); - b.ToTable("IdentityServerClients"); + b.ToTable("IdentityServerClients", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => @@ -1422,7 +1421,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientClaims"); + b.ToTable("IdentityServerClientClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => @@ -1436,7 +1435,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Origin"); - b.ToTable("IdentityServerClientCorsOrigins"); + b.ToTable("IdentityServerClientCorsOrigins", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => @@ -1450,7 +1449,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "GrantType"); - b.ToTable("IdentityServerClientGrantTypes"); + b.ToTable("IdentityServerClientGrantTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => @@ -1464,7 +1463,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Provider"); - b.ToTable("IdentityServerClientIdPRestrictions"); + b.ToTable("IdentityServerClientIdPRestrictions", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => @@ -1478,7 +1477,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "PostLogoutRedirectUri"); - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + b.ToTable("IdentityServerClientPostLogoutRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => @@ -1496,7 +1495,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Key", "Value"); - b.ToTable("IdentityServerClientProperties"); + b.ToTable("IdentityServerClientProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => @@ -1510,7 +1509,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "RedirectUri"); - b.ToTable("IdentityServerClientRedirectUris"); + b.ToTable("IdentityServerClientRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => @@ -1524,7 +1523,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Scope"); - b.ToTable("IdentityServerClientScopes"); + b.ToTable("IdentityServerClientScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => @@ -1549,7 +1548,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientSecrets"); + b.ToTable("IdentityServerClientSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => @@ -1621,7 +1620,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserCode"); - b.ToTable("IdentityServerDeviceFlowCodes"); + b.ToTable("IdentityServerDeviceFlowCodes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => @@ -1687,7 +1686,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "SessionId", "Type"); - b.ToTable("IdentityServerPersistedGrants"); + b.ToTable("IdentityServerPersistedGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => @@ -1763,7 +1762,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerIdentityResources"); + b.ToTable("IdentityServerIdentityResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => @@ -1777,7 +1776,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Type"); - b.ToTable("IdentityServerIdentityResourceClaims"); + b.ToTable("IdentityServerIdentityResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => @@ -1795,7 +1794,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Key", "Value"); - b.ToTable("IdentityServerIdentityResourceProperties"); + b.ToTable("IdentityServerIdentityResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -1825,9 +1824,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -1856,15 +1857,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") @@ -1916,7 +1918,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1935,7 +1937,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210909052730_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20211105130007_Initial.Designer.cs similarity index 95% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210909052730_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20211105130007_Initial.Designer.cs index 8107c2dcbe..491299d91d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210909052730_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20211105130007_Initial.Designer.cs @@ -8,10 +8,12 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.Blazor.Server.Host.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20210909052730_Initial")] + [Migration("20211105130007_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -19,9 +21,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -128,7 +131,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -178,7 +181,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -228,7 +231,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -270,7 +273,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -299,9 +302,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => @@ -348,7 +353,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => @@ -375,7 +380,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => @@ -424,7 +429,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -452,7 +457,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => @@ -527,7 +532,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => @@ -682,7 +687,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -710,7 +715,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -739,7 +744,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -766,7 +771,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -785,7 +790,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -810,7 +815,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => @@ -884,7 +889,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -911,7 +916,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -941,9 +946,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -972,9 +979,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => @@ -1032,7 +1041,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1051,7 +1060,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210909052730_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20211105130007_Initial.cs similarity index 98% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210909052730_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20211105130007_Initial.cs index 0d9af49008..c0357b760b 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210909052730_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20211105130007_Initial.cs @@ -1,6 +1,8 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations { public partial class Initial : Migration @@ -115,8 +117,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", column: x => x.ParentId, principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -545,7 +546,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations migrationBuilder.CreateIndex( name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", table: "AbpFeatureValues", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", @@ -570,9 +573,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations column: "ParentId"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + name: "IX_AbpPermissionGrants_TenantId_Name_ProviderName_ProviderKey", table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "TenantId", "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -607,7 +612,9 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations migrationBuilder.CreateIndex( name: "IX_AbpSettings_Name_ProviderName_ProviderKey", table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs index c394d8c737..4e62c44825 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs @@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.Blazor.Server.Host.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations { [DbContext(typeof(UnifiedDbContext))] @@ -17,9 +19,10 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -126,7 +129,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -176,7 +179,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -226,7 +229,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -268,7 +271,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -297,9 +300,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => @@ -346,7 +351,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => @@ -373,7 +378,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => @@ -422,7 +427,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -450,7 +455,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => @@ -525,7 +530,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => @@ -680,7 +685,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -708,7 +713,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -737,7 +742,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -764,7 +769,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -783,7 +788,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -808,7 +813,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => @@ -882,7 +887,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -909,7 +914,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -939,9 +944,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -970,9 +977,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => @@ -1030,7 +1039,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1049,7 +1058,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210909052712_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20211105130012_Initial.Designer.cs similarity index 96% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210909052712_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20211105130012_Initial.Designer.cs index b9edb3b1a7..db585d53e3 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210909052712_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20211105130012_Initial.Designer.cs @@ -8,10 +8,12 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20210909052712_Initial")] + [Migration("20211105130012_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -19,9 +21,10 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -128,7 +131,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -178,7 +181,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -228,7 +231,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -270,7 +273,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -299,9 +302,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => @@ -348,7 +353,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => @@ -375,7 +380,7 @@ namespace MyCompanyName.MyProjectName.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => @@ -424,7 +429,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -452,7 +457,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => @@ -527,7 +532,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => @@ -682,7 +687,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -710,7 +715,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -739,7 +744,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -766,7 +771,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -785,7 +790,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -810,7 +815,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => @@ -884,7 +889,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -911,7 +916,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => @@ -985,7 +990,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiResources"); + b.ToTable("IdentityServerApiResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => @@ -999,7 +1004,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type"); - b.ToTable("IdentityServerApiResourceClaims"); + b.ToTable("IdentityServerApiResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => @@ -1017,7 +1022,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Key", "Value"); - b.ToTable("IdentityServerApiResourceProperties"); + b.ToTable("IdentityServerApiResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => @@ -1031,7 +1036,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Scope"); - b.ToTable("IdentityServerApiResourceScopes"); + b.ToTable("IdentityServerApiResourceScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => @@ -1056,7 +1061,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type", "Value"); - b.ToTable("IdentityServerApiResourceSecrets"); + b.ToTable("IdentityServerApiResourceSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => @@ -1132,7 +1137,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiScopes"); + b.ToTable("IdentityServerApiScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => @@ -1146,7 +1151,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Type"); - b.ToTable("IdentityServerApiScopeClaims"); + b.ToTable("IdentityServerApiScopeClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => @@ -1164,7 +1169,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Key", "Value"); - b.ToTable("IdentityServerApiScopeProperties"); + b.ToTable("IdentityServerApiScopeProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => @@ -1348,7 +1353,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ClientId"); - b.ToTable("IdentityServerClients"); + b.ToTable("IdentityServerClients", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => @@ -1366,7 +1371,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientClaims"); + b.ToTable("IdentityServerClientClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => @@ -1380,7 +1385,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Origin"); - b.ToTable("IdentityServerClientCorsOrigins"); + b.ToTable("IdentityServerClientCorsOrigins", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => @@ -1394,7 +1399,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "GrantType"); - b.ToTable("IdentityServerClientGrantTypes"); + b.ToTable("IdentityServerClientGrantTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => @@ -1408,7 +1413,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Provider"); - b.ToTable("IdentityServerClientIdPRestrictions"); + b.ToTable("IdentityServerClientIdPRestrictions", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => @@ -1422,7 +1427,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "PostLogoutRedirectUri"); - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + b.ToTable("IdentityServerClientPostLogoutRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => @@ -1440,7 +1445,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Key", "Value"); - b.ToTable("IdentityServerClientProperties"); + b.ToTable("IdentityServerClientProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => @@ -1454,7 +1459,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "RedirectUri"); - b.ToTable("IdentityServerClientRedirectUris"); + b.ToTable("IdentityServerClientRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => @@ -1468,7 +1473,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Scope"); - b.ToTable("IdentityServerClientScopes"); + b.ToTable("IdentityServerClientScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => @@ -1493,7 +1498,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientSecrets"); + b.ToTable("IdentityServerClientSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => @@ -1565,7 +1570,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserCode"); - b.ToTable("IdentityServerDeviceFlowCodes"); + b.ToTable("IdentityServerDeviceFlowCodes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => @@ -1631,7 +1636,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "SessionId", "Type"); - b.ToTable("IdentityServerPersistedGrants"); + b.ToTable("IdentityServerPersistedGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => @@ -1707,7 +1712,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerIdentityResources"); + b.ToTable("IdentityServerIdentityResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => @@ -1721,7 +1726,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Type"); - b.ToTable("IdentityServerIdentityResourceClaims"); + b.ToTable("IdentityServerIdentityResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => @@ -1739,7 +1744,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Key", "Value"); - b.ToTable("IdentityServerIdentityResourceProperties"); + b.ToTable("IdentityServerIdentityResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -1769,9 +1774,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -1800,9 +1807,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => @@ -1860,7 +1869,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1879,7 +1888,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210909052712_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20211105130012_Initial.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210909052712_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20211105130012_Initial.cs index 5333a6a34e..abec77f8c4 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210909052712_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20211105130012_Initial.cs @@ -1,6 +1,8 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { public partial class Initial : Migration @@ -115,8 +117,7 @@ namespace MyCompanyName.MyProjectName.Migrations name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", column: x => x.ParentId, principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -1047,7 +1048,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", table: "AbpFeatureValues", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", @@ -1072,9 +1075,11 @@ namespace MyCompanyName.MyProjectName.Migrations column: "ParentId"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + name: "IX_AbpPermissionGrants_TenantId_Name_ProviderName_ProviderKey", table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "TenantId", "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -1109,7 +1114,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_AbpSettings_Name_ProviderName_ProviderKey", table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index aa156c5d53..d870fa25cc 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(IdentityServerHostMigrationsDbContext))] @@ -17,9 +19,10 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -126,7 +129,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -176,7 +179,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -226,7 +229,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -268,7 +271,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -297,9 +300,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => @@ -346,7 +351,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => @@ -373,7 +378,7 @@ namespace MyCompanyName.MyProjectName.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => @@ -422,7 +427,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -450,7 +455,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => @@ -525,7 +530,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => @@ -680,7 +685,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -708,7 +713,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -737,7 +742,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -764,7 +769,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -783,7 +788,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -808,7 +813,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => @@ -882,7 +887,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -909,7 +914,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => @@ -983,7 +988,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiResources"); + b.ToTable("IdentityServerApiResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => @@ -997,7 +1002,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type"); - b.ToTable("IdentityServerApiResourceClaims"); + b.ToTable("IdentityServerApiResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => @@ -1015,7 +1020,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Key", "Value"); - b.ToTable("IdentityServerApiResourceProperties"); + b.ToTable("IdentityServerApiResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => @@ -1029,7 +1034,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Scope"); - b.ToTable("IdentityServerApiResourceScopes"); + b.ToTable("IdentityServerApiResourceScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => @@ -1054,7 +1059,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type", "Value"); - b.ToTable("IdentityServerApiResourceSecrets"); + b.ToTable("IdentityServerApiResourceSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => @@ -1130,7 +1135,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerApiScopes"); + b.ToTable("IdentityServerApiScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => @@ -1144,7 +1149,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Type"); - b.ToTable("IdentityServerApiScopeClaims"); + b.ToTable("IdentityServerApiScopeClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => @@ -1162,7 +1167,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiScopeId", "Key", "Value"); - b.ToTable("IdentityServerApiScopeProperties"); + b.ToTable("IdentityServerApiScopeProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => @@ -1346,7 +1351,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ClientId"); - b.ToTable("IdentityServerClients"); + b.ToTable("IdentityServerClients", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => @@ -1364,7 +1369,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientClaims"); + b.ToTable("IdentityServerClientClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => @@ -1378,7 +1383,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Origin"); - b.ToTable("IdentityServerClientCorsOrigins"); + b.ToTable("IdentityServerClientCorsOrigins", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => @@ -1392,7 +1397,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "GrantType"); - b.ToTable("IdentityServerClientGrantTypes"); + b.ToTable("IdentityServerClientGrantTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => @@ -1406,7 +1411,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Provider"); - b.ToTable("IdentityServerClientIdPRestrictions"); + b.ToTable("IdentityServerClientIdPRestrictions", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => @@ -1420,7 +1425,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "PostLogoutRedirectUri"); - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + b.ToTable("IdentityServerClientPostLogoutRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => @@ -1438,7 +1443,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Key", "Value"); - b.ToTable("IdentityServerClientProperties"); + b.ToTable("IdentityServerClientProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => @@ -1452,7 +1457,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "RedirectUri"); - b.ToTable("IdentityServerClientRedirectUris"); + b.ToTable("IdentityServerClientRedirectUris", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => @@ -1466,7 +1471,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Scope"); - b.ToTable("IdentityServerClientScopes"); + b.ToTable("IdentityServerClientScopes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => @@ -1491,7 +1496,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ClientId", "Type", "Value"); - b.ToTable("IdentityServerClientSecrets"); + b.ToTable("IdentityServerClientSecrets", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => @@ -1563,7 +1568,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserCode"); - b.ToTable("IdentityServerDeviceFlowCodes"); + b.ToTable("IdentityServerDeviceFlowCodes", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => @@ -1629,7 +1634,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "SessionId", "Type"); - b.ToTable("IdentityServerPersistedGrants"); + b.ToTable("IdentityServerPersistedGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => @@ -1705,7 +1710,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("IdentityServerIdentityResources"); + b.ToTable("IdentityServerIdentityResources", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => @@ -1719,7 +1724,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Type"); - b.ToTable("IdentityServerIdentityResourceClaims"); + b.ToTable("IdentityServerIdentityResourceClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => @@ -1737,7 +1742,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("IdentityResourceId", "Key", "Value"); - b.ToTable("IdentityServerIdentityResourceProperties"); + b.ToTable("IdentityServerIdentityResourceProperties", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -1767,9 +1772,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -1798,9 +1805,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => @@ -1858,7 +1867,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1877,7 +1886,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210909052706_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20211105130018_Initial.Designer.cs similarity index 95% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210909052706_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20211105130018_Initial.Designer.cs index 993934aedb..8da056ea6d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210909052706_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20211105130018_Initial.Designer.cs @@ -8,10 +8,12 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20210909052706_Initial")] + [Migration("20211105130018_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -19,9 +21,10 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -128,7 +131,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -178,7 +181,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -228,7 +231,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -270,7 +273,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -299,9 +302,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => @@ -348,7 +353,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => @@ -375,7 +380,7 @@ namespace MyCompanyName.MyProjectName.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => @@ -424,7 +429,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -452,7 +457,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => @@ -527,7 +532,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => @@ -682,7 +687,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -710,7 +715,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -739,7 +744,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -766,7 +771,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -785,7 +790,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -810,7 +815,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => @@ -884,7 +889,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -911,7 +916,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -941,9 +946,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -972,9 +979,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => @@ -1032,7 +1041,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1051,7 +1060,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210909052706_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20211105130018_Initial.cs similarity index 98% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210909052706_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20211105130018_Initial.cs index b7465b0dcb..4fc6e66561 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210909052706_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20211105130018_Initial.cs @@ -1,6 +1,8 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { public partial class Initial : Migration @@ -115,8 +117,7 @@ namespace MyCompanyName.MyProjectName.Migrations name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", column: x => x.ParentId, principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -545,7 +546,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", table: "AbpFeatureValues", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", @@ -570,9 +573,11 @@ namespace MyCompanyName.MyProjectName.Migrations column: "ParentId"); migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + name: "IX_AbpPermissionGrants_TenantId_Name_ProviderName_ProviderKey", table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "TenantId", "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[TenantId] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_RoleId", @@ -607,7 +612,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_AbpSettings_Name_ProviderName_ProviderKey", table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); + columns: new[] { "Name", "ProviderName", "ProviderKey" }, + unique: true, + filter: "[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index 472749a2a0..da1769556d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using MyCompanyName.MyProjectName.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +#nullable disable + namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(UnifiedDbContext))] @@ -17,9 +19,10 @@ namespace MyCompanyName.MyProjectName.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -126,7 +129,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId", "ExecutionTime"); - b.ToTable("AbpAuditLogs"); + b.ToTable("AbpAuditLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => @@ -176,7 +179,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - b.ToTable("AbpAuditLogActions"); + b.ToTable("AbpAuditLogActions", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => @@ -226,7 +229,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - b.ToTable("AbpEntityChanges"); + b.ToTable("AbpEntityChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => @@ -268,7 +271,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("EntityChangeId"); - b.ToTable("AbpEntityPropertyChanges"); + b.ToTable("AbpEntityPropertyChanges", (string)null); }); modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => @@ -297,9 +300,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpFeatureValues"); + b.ToTable("AbpFeatureValues", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => @@ -346,7 +351,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.ToTable("AbpClaimTypes"); + b.ToTable("AbpClaimTypes", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => @@ -373,7 +378,7 @@ namespace MyCompanyName.MyProjectName.Migrations .IsUnique() .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - b.ToTable("AbpLinkUsers"); + b.ToTable("AbpLinkUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => @@ -422,7 +427,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("NormalizedName"); - b.ToTable("AbpRoles"); + b.ToTable("AbpRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => @@ -450,7 +455,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId"); - b.ToTable("AbpRoleClaims"); + b.ToTable("AbpRoleClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => @@ -525,7 +530,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("TenantId", "UserId"); - b.ToTable("AbpSecurityLogs"); + b.ToTable("AbpSecurityLogs", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => @@ -680,7 +685,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserName"); - b.ToTable("AbpUsers"); + b.ToTable("AbpUsers", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -708,7 +713,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId"); - b.ToTable("AbpUserClaims"); + b.ToTable("AbpUserClaims", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => @@ -737,7 +742,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("LoginProvider", "ProviderKey"); - b.ToTable("AbpUserLogins"); + b.ToTable("AbpUserLogins", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => @@ -764,7 +769,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("UserId", "OrganizationUnitId"); - b.ToTable("AbpUserOrganizationUnits"); + b.ToTable("AbpUserOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => @@ -783,7 +788,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "UserId"); - b.ToTable("AbpUserRoles"); + b.ToTable("AbpUserRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => @@ -808,7 +813,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AbpUserTokens"); + b.ToTable("AbpUserTokens", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => @@ -882,7 +887,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("ParentId"); - b.ToTable("AbpOrganizationUnits"); + b.ToTable("AbpOrganizationUnits", (string)null); }); modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => @@ -909,7 +914,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("RoleId", "OrganizationUnitId"); - b.ToTable("AbpOrganizationUnitRoles"); + b.ToTable("AbpOrganizationUnitRoles", (string)null); }); modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => @@ -939,9 +944,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); - b.ToTable("AbpPermissionGrants"); + b.ToTable("AbpPermissionGrants", (string)null); }); modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => @@ -970,9 +977,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); - b.HasIndex("Name", "ProviderName", "ProviderKey"); + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); - b.ToTable("AbpSettings"); + b.ToTable("AbpSettings", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => @@ -1030,7 +1039,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Name"); - b.ToTable("AbpTenants"); + b.ToTable("AbpTenants", (string)null); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => @@ -1049,7 +1058,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("TenantId", "Name"); - b.ToTable("AbpTenantConnectionStrings"); + b.ToTable("AbpTenantConnectionStrings", (string)null); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>