diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs
index 534ca68d80..08a8c4c873 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs
@@ -15,6 +15,10 @@ public class CurrentUserDto
public Guid? ImpersonatorTenantId { get; set; }
+ public string ImpersonatorUserName { get; set; }
+
+ public string ImpersonatorTenantName { get; set; }
+
public string UserName { get; set; }
public string Name { get; set; }
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
index ea517463fe..6ecd9fc195 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
@@ -129,6 +129,8 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp
TenantId = _currentUser.TenantId,
ImpersonatorUserId = _currentUser.FindImpersonatorUserId(),
ImpersonatorTenantId = _currentUser.FindImpersonatorTenantId(),
+ ImpersonatorUserName = _currentUser.FindImpersonatorUserName(),
+ ImpersonatorTenantName = _currentUser.FindImpersonatorTenantName(),
UserName = _currentUser.UserName,
SurName = _currentUser.SurName,
Name = _currentUser.Name,
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogInfo.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogInfo.cs
index f8fcbeef5e..4df472da24 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogInfo.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogInfo.cs
@@ -23,6 +23,10 @@ public class AuditLogInfo : IHasExtraProperties
public Guid? ImpersonatorTenantId { get; set; }
+ public string ImpersonatorUserName { get; set; }
+
+ public string ImpersonatorTenantName { get; set; }
+
public DateTime ExecutionTime { get; set; }
public int ExecutionDuration { get; set; }
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs
index 934bf42583..1f3c6b433c 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs
@@ -136,9 +136,11 @@ public class AuditingHelper : IAuditingHelper, ITransientDependency
UserName = CurrentUser.UserName,
ClientId = CurrentClient.Id,
CorrelationId = CorrelationIdProvider.Get(),
+ ExecutionTime = Clock.Now,
ImpersonatorUserId = CurrentUser.FindImpersonatorUserId(),
+ ImpersonatorUserName = CurrentUser.FindImpersonatorUserName(),
ImpersonatorTenantId = CurrentUser.FindImpersonatorTenantId(),
- ExecutionTime = Clock.Now
+ ImpersonatorTenantName = CurrentUser.FindImpersonatorTenantName(),
};
ExecutePreContributors(auditInfo);
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimTypes.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimTypes.cs
index 034336a9d9..5e534226a1 100644
--- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimTypes.cs
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimTypes.cs
@@ -77,4 +77,14 @@ public static class AbpClaimTypes
/// Default: "impersonator_userid".
///
public static string ImpersonatorUserId { get; set; } = "impersonator_userid";
+
+ ///
+ /// Default: "impersonator_tenantname".
+ ///
+ public static string ImpersonatorTenantName { get; set; } = "impersonator_tenantname";
+
+ ///
+ /// Default: "impersonator_username".
+ ///
+ public static string ImpersonatorUserName { get; set; } = "impersonator_username";
}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs
index 78fd42ab76..7e10df87c6 100644
--- a/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs
@@ -35,7 +35,7 @@ public static class CurrentUserExtensions
public static Guid? FindImpersonatorTenantId([NotNull] this ICurrentUser currentUser)
{
var impersonatorTenantId = currentUser.FindClaimValue(AbpClaimTypes.ImpersonatorTenantId);
- if (impersonatorTenantId == null || impersonatorTenantId.IsNullOrWhiteSpace())
+ if (impersonatorTenantId.IsNullOrWhiteSpace())
{
return null;
}
@@ -50,7 +50,7 @@ public static class CurrentUserExtensions
public static Guid? FindImpersonatorUserId([NotNull] this ICurrentUser currentUser)
{
var impersonatorUserId = currentUser.FindClaimValue(AbpClaimTypes.ImpersonatorUserId);
- if (impersonatorUserId == null || impersonatorUserId.IsNullOrWhiteSpace())
+ if (impersonatorUserId.IsNullOrWhiteSpace())
{
return null;
}
@@ -61,4 +61,14 @@ public static class CurrentUserExtensions
return null;
}
+
+ public static string FindImpersonatorTenantName([NotNull] this ICurrentUser currentUser)
+ {
+ return currentUser.FindClaimValue(AbpClaimTypes.ImpersonatorTenantName);
+ }
+
+ public static string FindImpersonatorUserName([NotNull] this ICurrentUser currentUser)
+ {
+ return currentUser.FindClaimValue(AbpClaimTypes.ImpersonatorUserName);
+ }
}
diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs
index ac7df6a47f..c2cb670704 100644
--- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs
+++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs
@@ -24,8 +24,12 @@ public class AuditLog : AggregateRoot, IMultiTenant
public virtual Guid? ImpersonatorUserId { get; protected set; }
+ public virtual string ImpersonatorUserName { get; protected set; }
+
public virtual Guid? ImpersonatorTenantId { get; protected set; }
+ public virtual string ImpersonatorTenantName { get; protected set; }
+
public virtual DateTime ExecutionTime { get; protected set; }
public virtual int ExecutionDuration { get; protected set; }
@@ -77,7 +81,9 @@ public class AuditLog : AggregateRoot, IMultiTenant
string url,
int? httpStatusCode,
Guid? impersonatorUserId,
+ string impersonatorUserName,
Guid? impersonatorTenantId,
+ string impersonatorTenantName,
ExtraPropertyDictionary extraPropertyDictionary,
List entityChanges,
List actions,
@@ -101,8 +107,9 @@ public class AuditLog : AggregateRoot, IMultiTenant
Url = url.Truncate(AuditLogConsts.MaxUrlLength);
HttpStatusCode = httpStatusCode;
ImpersonatorUserId = impersonatorUserId;
+ ImpersonatorUserName = impersonatorUserName.Truncate(AuditLogConsts.MaxUserNameLength);
ImpersonatorTenantId = impersonatorTenantId;
-
+ ImpersonatorTenantName = impersonatorTenantName.Truncate(AuditLogConsts.MaxTenantNameLength);
ExtraProperties = extraPropertyDictionary;
EntityChanges = entityChanges;
Actions = actions;
diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs
index 20f5a3629f..6f2b276df3 100644
--- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs
+++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs
@@ -79,7 +79,9 @@ public class AuditLogInfoToAuditLogConverter : IAuditLogInfoToAuditLogConverter,
auditLogInfo.Url,
auditLogInfo.HttpStatusCode,
auditLogInfo.ImpersonatorUserId,
+ auditLogInfo.ImpersonatorUserName,
auditLogInfo.ImpersonatorTenantId,
+ auditLogInfo.ImpersonatorTenantName,
extraProperties,
entityChanges,
actions,
diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs
index 1c17a374ce..8a3cd7de23 100644
--- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs
+++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs
@@ -31,9 +31,12 @@ public static class AbpAuditLoggingDbContextModelBuilderExtensions
b.Property(x => x.ExecutionDuration).HasColumnName(nameof(AuditLog.ExecutionDuration));
b.Property(x => x.ImpersonatorTenantId).HasColumnName(nameof(AuditLog.ImpersonatorTenantId));
b.Property(x => x.ImpersonatorUserId).HasColumnName(nameof(AuditLog.ImpersonatorUserId));
+ b.Property(x => x.ImpersonatorTenantName).HasMaxLength(AuditLogConsts.MaxTenantNameLength).HasColumnName(nameof(AuditLog.ImpersonatorTenantName));
+ b.Property(x => x.ImpersonatorUserName).HasMaxLength(AuditLogConsts.MaxUserNameLength).HasColumnName(nameof(AuditLog.ImpersonatorUserName));
b.Property(x => x.UserId).HasColumnName(nameof(AuditLog.UserId));
b.Property(x => x.UserName).HasMaxLength(AuditLogConsts.MaxUserNameLength).HasColumnName(nameof(AuditLog.UserName));
b.Property(x => x.TenantId).HasColumnName(nameof(AuditLog.TenantId));
+ b.Property(x => x.TenantName).HasMaxLength(AuditLogConsts.MaxTenantNameLength).HasColumnName(nameof(AuditLog.TenantName));
b.HasMany(a => a.Actions).WithOne().HasForeignKey(x => x.AuditLogId).IsRequired();
b.HasMany(a => a.EntityChanges).WithOne().HasForeignKey(x => x.AuditLogId).IsRequired();
diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs
index 0a56e3f398..17f365147d 100644
--- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs
+++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs
@@ -36,6 +36,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -87,6 +89,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -140,6 +144,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -191,6 +197,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -242,6 +250,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.SpecifyKind(DateTime.Parse("2020-01-01 01:00:00"), DateTimeKind.Utc),
ExecutionDuration = 45,
ClientIpAddress = ipAddress,
@@ -293,6 +303,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.SpecifyKind(DateTime.Parse("2020-01-01 03:00:00"), DateTimeKind.Utc),
ExecutionDuration = 55,
ClientIpAddress = ipAddress,
@@ -346,6 +358,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -397,6 +411,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -452,6 +468,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -503,6 +521,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -559,6 +579,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -610,6 +632,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -673,6 +697,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -723,6 +749,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -780,6 +808,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -831,6 +861,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -893,6 +925,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -944,6 +978,8 @@ public abstract class AuditLogRepository_Tests : AuditLoggingTes
UserId = userId2,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs
index 102456bc66..9174bfc6b9 100644
--- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs
+++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs
@@ -35,6 +35,8 @@ public abstract class AuditStore_Basic_Tests : AuditLoggingTestB
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -90,6 +92,8 @@ public abstract class AuditStore_Basic_Tests : AuditLoggingTestB
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
@@ -141,6 +145,8 @@ public abstract class AuditStore_Basic_Tests : AuditLoggingTestB
UserId = userId,
ImpersonatorUserId = Guid.NewGuid(),
ImpersonatorTenantId = Guid.NewGuid(),
+ ImpersonatorTenantName = "default",
+ ImpersonatorUserName = "admin",
ExecutionTime = DateTime.Today,
ExecutionDuration = 42,
ClientIpAddress = ipAddress,
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.cs
deleted file mode 100644
index 24e64888b2..0000000000
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20211105125915_Initial.cs
+++ /dev/null
@@ -1,1323 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace MyCompanyName.MyProjectName.Migrations;
-
-public partial class Initial : Migration
-{
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "AbpAuditLogs",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true),
- UserId = table.Column(type: "uniqueidentifier", nullable: true),
- UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
- TenantId = table.Column(type: "uniqueidentifier", nullable: true),
- TenantName = table.Column(type: "nvarchar(max)", nullable: true),
- ImpersonatorUserId = table.Column(type: "uniqueidentifier", nullable: true),
- ImpersonatorTenantId = table.Column(type: "uniqueidentifier", nullable: true),
- ExecutionTime = table.Column(type: "datetime2", nullable: false),
- ExecutionDuration = table.Column(type: "int", nullable: false),
- ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- ClientName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true),
- ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true),
- HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true),
- Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
- Exceptions = table.Column(type: "nvarchar(max)", nullable: true),
- Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
- HttpStatusCode = table.Column(type: "int", nullable: true),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpAuditLogs", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpBackgroundJobs",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- JobName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
- JobArgs = table.Column(type: "nvarchar(max)", maxLength: 1048576, nullable: false),
- TryCount = table.Column(type: "smallint", nullable: false, defaultValue: (short)0),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- NextTryTime = table.Column(type: "datetime2", nullable: false),
- LastTryTime = table.Column(type: "datetime2", nullable: true),
- IsAbandoned = table.Column(type: "bit", nullable: false, defaultValue: false),
- Priority = table.Column(type: "tinyint", nullable: false, defaultValue: (byte)15),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpClaimTypes",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- Required = table.Column(type: "bit", nullable: false),
- IsStatic = table.Column(type: "bit", nullable: false),
- Regex = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true),
- RegexDescription = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true),
- Description = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
- ValueType = table.Column(type: "int", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpFeatureValues",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
- Value = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
- ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpFeatureValues", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpLinkUsers",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- SourceUserId = table.Column(type: "uniqueidentifier", nullable: false),
- SourceTenantId = table.Column(type: "uniqueidentifier", nullable: true),
- TargetUserId = table.Column(type: "uniqueidentifier", nullable: false),
- TargetTenantId = table.Column(type: "uniqueidentifier", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpLinkUsers", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpOrganizationUnits",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- TenantId = table.Column(type: "uniqueidentifier", nullable: true),
- ParentId = table.Column(type: "uniqueidentifier", nullable: true),
- Code = table.Column(type: "nvarchar(95)", maxLength: 95, nullable: false),
- DisplayName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
- LastModificationTime = table.Column(type: "datetime2", nullable: true),
- LastModifierId = table.Column(type: "uniqueidentifier", nullable: true),
- IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false),
- DeleterId = table.Column(type: "uniqueidentifier", nullable: true),
- DeletionTime = table.Column(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id);
- table.ForeignKey(
- name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId",
- column: x => x.ParentId,
- principalTable: "AbpOrganizationUnits",
- principalColumn: "Id");
- });
-
- migrationBuilder.CreateTable(
- name: "AbpPermissionGrants",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- TenantId = table.Column(type: "uniqueidentifier", nullable: true),
- Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
- ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
- ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpRoles",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- TenantId = table.Column(type: "uniqueidentifier", nullable: true),
- Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- IsDefault = table.Column(type: "bit", nullable: false),
- IsStatic = table.Column(type: "bit", nullable: false),
- IsPublic = table.Column(type: "bit", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpRoles", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpSecurityLogs",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- TenantId = table.Column(type: "uniqueidentifier", nullable: true),
- ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true),
- Identity = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true),
- Action = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true),
- UserId = table.Column(type: "uniqueidentifier", nullable: true),
- UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
- TenantName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpSettings",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
- Value = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false),
- ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpSettings", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpTenants",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
- LastModificationTime = table.Column(type: "datetime2", nullable: true),
- LastModifierId = table.Column(type: "uniqueidentifier", nullable: true),
- IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false),
- DeleterId = table.Column(type: "uniqueidentifier", nullable: true),
- DeletionTime = table.Column(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpTenants", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AbpUsers",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- TenantId = table.Column(type: "uniqueidentifier", nullable: true),
- UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- Surname = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
- Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- EmailConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false),
- PasswordHash = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
- SecurityStamp = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
- IsExternal = table.Column(type: "bit", nullable: false, defaultValue: false),
- PhoneNumber = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true),
- PhoneNumberConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false),
- IsActive = table.Column(type: "bit", nullable: false),
- TwoFactorEnabled = table.Column(type: "bit", nullable: false, defaultValue: false),
- LockoutEnd = table.Column(type: "datetimeoffset", nullable: true),
- LockoutEnabled = table.Column(type: "bit", nullable: false, defaultValue: false),
- AccessFailedCount = table.Column(type: "int", nullable: false, defaultValue: 0),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
- LastModificationTime = table.Column(type: "datetime2", nullable: true),
- LastModifierId = table.Column(type: "uniqueidentifier", nullable: true),
- IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false),
- DeleterId = table.Column(type: "uniqueidentifier", nullable: true),
- DeletionTime = table.Column(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AbpUsers", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "IdentityServerApiResources",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
- DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
- Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
- Enabled = table.Column(type: "bit", nullable: false),
- AllowedAccessTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
- ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
- LastModificationTime = table.Column(type: "datetime2", nullable: true),
- LastModifierId = table.Column(type: "uniqueidentifier", nullable: true),
- IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false),
- DeleterId = table.Column(type: "uniqueidentifier", nullable: true),
- DeletionTime = table.Column(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "IdentityServerApiScopes",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- Enabled = table.Column(type: "bit", nullable: false),
- Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
- DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
- Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
- Required = table.Column(type: "bit", nullable: false),
- Emphasize = table.Column(type: "bit", nullable: false),
- ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
- LastModificationTime = table.Column(type: "datetime2", nullable: true),
- LastModifierId = table.Column(type: "uniqueidentifier", nullable: true),
- IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false),
- DeleterId = table.Column(type: "uniqueidentifier", nullable: true),
- DeletionTime = table.Column(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_IdentityServerApiScopes", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "IdentityServerClients",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
- ClientName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
- Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
- ClientUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
- LogoUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
- Enabled = table.Column(type: "bit", nullable: false),
- ProtocolType = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
- RequireClientSecret = table.Column(type: "bit", nullable: false),
- RequireConsent = table.Column(type: "bit", nullable: false),
- AllowRememberConsent = table.Column(type: "bit", nullable: false),
- AlwaysIncludeUserClaimsInIdToken = table.Column(type: "bit", nullable: false),
- RequirePkce = table.Column(type: "bit", nullable: false),
- AllowPlainTextPkce = table.Column(type: "bit", nullable: false),
- RequireRequestObject = table.Column(type: "bit", nullable: false),
- AllowAccessTokensViaBrowser = table.Column(type: "bit", nullable: false),
- FrontChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
- FrontChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false),
- BackChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
- BackChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false),
- AllowOfflineAccess = table.Column(type: "bit", nullable: false),
- IdentityTokenLifetime = table.Column(type: "int", nullable: false),
- AllowedIdentityTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
- AccessTokenLifetime = table.Column(type: "int", nullable: false),
- AuthorizationCodeLifetime = table.Column(type: "int", nullable: false),
- ConsentLifetime = table.Column(type: "int", nullable: true),
- AbsoluteRefreshTokenLifetime = table.Column(type: "int", nullable: false),
- SlidingRefreshTokenLifetime = table.Column(type: "int", nullable: false),
- RefreshTokenUsage = table.Column(type: "int", nullable: false),
- UpdateAccessTokenClaimsOnRefresh = table.Column(type: "bit", nullable: false),
- RefreshTokenExpiration = table.Column(type: "int", nullable: false),
- AccessTokenType = table.Column(type: "int", nullable: false),
- EnableLocalLogin = table.Column(type: "bit", nullable: false),
- IncludeJwtId = table.Column(type: "bit", nullable: false),
- AlwaysSendClientClaims = table.Column(type: "bit", nullable: false),
- ClientClaimsPrefix = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
- PairWiseSubjectSalt = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
- UserSsoLifetime = table.Column(type: "int", nullable: true),
- UserCodeType = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
- DeviceCodeLifetime = table.Column(type: "int", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
- CreationTime = table.Column(type: "datetime2", nullable: false),
- CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
- LastModificationTime = table.Column(type: "datetime2", nullable: true),
- LastModifierId = table.Column(type: "uniqueidentifier", nullable: true),
- IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false),
- DeleterId = table.Column(type: "uniqueidentifier", nullable: true),
- DeletionTime = table.Column(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_IdentityServerClients", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "IdentityServerDeviceFlowCodes",
- columns: table => new {
- Id = table.Column(type: "uniqueidentifier", nullable: false),
- DeviceCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
- UserCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
- SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
- SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
- ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
- Description = table.Column