Browse Source
* Added the sending test email configuration * Added the interface for setting cache values * Added ts script support for clipull/752/head
41 changed files with 997 additions and 7012 deletions
@ -0,0 +1,12 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace LINGYUN.Abp.CachingManagement; |
||||
|
public class CacheSetInput |
||||
|
{ |
||||
|
[Required] |
||||
|
public string Key { get; set; } |
||||
|
public string Value { get; set; } |
||||
|
public DateTime? AbsoluteExpiration { get; set; } |
||||
|
public DateTime? SlidingExpiration { get; set; } |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace LINGYUN.Abp.CachingManagement; |
||||
|
public class SetCacheRequest |
||||
|
{ |
||||
|
[Required] |
||||
|
public string Key { get; } |
||||
|
[Required] |
||||
|
public string Value { get; } |
||||
|
public TimeSpan? AbsoluteExpiration { get; } |
||||
|
public TimeSpan? SlidingExpiration { get; } |
||||
|
public SetCacheRequest( |
||||
|
string key, |
||||
|
string value, |
||||
|
TimeSpan? absoluteExpiration = null, |
||||
|
TimeSpan? slidingExpiration = null) |
||||
|
{ |
||||
|
Key = key; |
||||
|
Value = value; |
||||
|
AbsoluteExpiration = absoluteExpiration; |
||||
|
SlidingExpiration = slidingExpiration; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
using Volo.Abp.Http.Modeling; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Cli.ServiceProxying.TypeScript; |
||||
|
|
||||
|
public interface ITypeScriptProxyGenerator |
||||
|
{ |
||||
|
string CreateModelScript( |
||||
|
ApplicationApiDescriptionModel appModel, |
||||
|
ControllerApiDescriptionModel actionModel); |
||||
|
|
||||
|
string CreateScript( |
||||
|
ApplicationApiDescriptionModel appModel, |
||||
|
ModuleApiDescriptionModel apiModel, |
||||
|
ControllerApiDescriptionModel actionModel); |
||||
|
} |
||||
@ -0,0 +1,445 @@ |
|||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Microsoft.Extensions.Logging.Abstractions; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
using Volo.Abp.ObjectExtending; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Cli.ServiceProxying.TypeScript; |
||||
|
public class TypeScriptProxyGenerator : ITypeScriptProxyGenerator, ITransientDependency |
||||
|
{ |
||||
|
protected static string[] AbpBaseTypes = new string[] |
||||
|
{ |
||||
|
typeof(ExtensibleObject).FullName, |
||||
|
"Volo.Abp.Application.Dtos.AuditedEntityDto", |
||||
|
"Volo.Abp.Application.Dtos.AuditedEntityWithUserDto", |
||||
|
"Volo.Abp.Application.Dtos.CreationAuditedEntityDto", |
||||
|
"Volo.Abp.Application.Dtos.CreationAuditedEntityWithUserDto", |
||||
|
"Volo.Abp.Application.Dtos.EntityDto", |
||||
|
"Volo.Abp.Application.Dtos.ExtensibleAuditedEntityDto", |
||||
|
"Volo.Abp.Application.Dtos.ExtensibleAuditedEntityWithUserDto", |
||||
|
"Volo.Abp.Application.Dtos.ExtensibleCreationAuditedEntityDto", |
||||
|
"Volo.Abp.Application.Dtos.ExtensibleCreationAuditedEntityWithUserDto", |
||||
|
"Volo.Abp.Application.Dtos.ExtensibleEntityDto", |
||||
|
"Volo.Abp.Application.Dtos.ExtensibleFullAuditedEntityDto", |
||||
|
"Volo.Abp.Application.Dtos.ExtensibleFullAuditedEntityWithUserDto", |
||||
|
"Volo.Abp.Application.Dtos.FullAuditedEntityDto", |
||||
|
"Volo.Abp.Application.Dtos.FullAuditedEntityWithUserDto", |
||||
|
"Volo.Abp.Application.Dtos.LimitedResultRequestDto", |
||||
|
"Volo.Abp.Application.Dtos.ListResultDto", |
||||
|
"Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", |
||||
|
"Volo.Abp.Application.Dtos.PagedResultDto", |
||||
|
"Volo.Abp.Application.Dtos.PagedResultRequestDto", |
||||
|
}; |
||||
|
protected static string[] DataInParamMethods = new string[] |
||||
|
{ |
||||
|
"GET", |
||||
|
"DELETE" |
||||
|
}; |
||||
|
|
||||
|
public ILogger<TypeScriptProxyGenerator> Logger { protected get; set; } |
||||
|
public TypeScriptProxyGenerator() |
||||
|
{ |
||||
|
Logger = NullLogger<TypeScriptProxyGenerator>.Instance; |
||||
|
} |
||||
|
|
||||
|
public string CreateModelScript(ApplicationApiDescriptionModel appModel, ControllerApiDescriptionModel actionModel) |
||||
|
{ |
||||
|
var modelScriptBuilder = new StringBuilder(); |
||||
|
var modelBaseTypes = new List<string>(); |
||||
|
var modelTypes = new List<string>(); |
||||
|
|
||||
|
foreach (var action in actionModel.Actions) |
||||
|
{ |
||||
|
foreach (var paramter in action.Value.Parameters) |
||||
|
{ |
||||
|
if (appModel.Types.TryGetValue(paramter.Type, out var modelType)) |
||||
|
{ |
||||
|
var modelTypeName = paramter.Type[(paramter.Type.LastIndexOf('.') + 1)..]; |
||||
|
|
||||
|
if (!modelTypes.Contains(modelTypeName)) |
||||
|
{ |
||||
|
Logger.LogInformation($" Generating model: {modelTypeName} script."); |
||||
|
|
||||
|
modelScriptBuilder.AppendLine(CreateModel(modelTypeName, modelType)); |
||||
|
|
||||
|
Logger.LogInformation($" Model: {modelTypeName} generate successful."); |
||||
|
|
||||
|
modelTypes.AddIfNotContains(modelTypeName); |
||||
|
} |
||||
|
|
||||
|
// 字段类型
|
||||
|
foreach (var propertity in modelType.Properties) |
||||
|
{ |
||||
|
modelBaseTypes.AddIfNotContains(FindBaseTypes(appModel, propertity)); |
||||
|
} |
||||
|
|
||||
|
// 类型基类
|
||||
|
modelBaseTypes.AddIfNotContains(FindBaseTypes(appModel, modelType)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
foreach (var paramter in action.Value.ParametersOnMethod) |
||||
|
{ |
||||
|
if (appModel.Types.TryGetValue(paramter.Type, out var modelType)) |
||||
|
{ |
||||
|
var modelTypeName = paramter.Type[(paramter.Type.LastIndexOf('.') + 1)..]; |
||||
|
|
||||
|
if (!modelTypes.Contains(modelTypeName)) |
||||
|
{ |
||||
|
Logger.LogInformation($" Generating model: {modelTypeName} script."); |
||||
|
|
||||
|
modelScriptBuilder.AppendLine(CreateModel(modelTypeName, modelType)); |
||||
|
|
||||
|
Logger.LogInformation($" Model: {modelTypeName} generate successful."); |
||||
|
|
||||
|
modelTypes.AddIfNotContains(modelTypeName); |
||||
|
} |
||||
|
|
||||
|
// 字段类型
|
||||
|
foreach (var propertity in modelType.Properties) |
||||
|
{ |
||||
|
modelBaseTypes.AddIfNotContains(FindBaseTypes(appModel, propertity)); |
||||
|
} |
||||
|
|
||||
|
// 类型基类
|
||||
|
modelBaseTypes.AddIfNotContains(FindBaseTypes(appModel, modelType)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 返回类型
|
||||
|
var returnType = action.Value.ReturnValue.TypeSimple; |
||||
|
var abpBaseType = AbpBaseTypes.FirstOrDefault(basType => returnType.StartsWith(basType)); |
||||
|
if (!abpBaseType.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
returnType = returnType |
||||
|
.Replace(abpBaseType, "") |
||||
|
.Replace("<", "") |
||||
|
.Replace(">", ""); |
||||
|
} |
||||
|
|
||||
|
returnType = ReplaceTypeSimple(returnType); |
||||
|
|
||||
|
if (appModel.Types.TryGetValue(returnType, out var returnBaseType)) |
||||
|
{ |
||||
|
foreach (var propertity in returnBaseType.Properties) |
||||
|
{ |
||||
|
var propType = propertity.TypeSimple; |
||||
|
if (propertity.TypeSimple.StartsWith("[") && propertity.TypeSimple.EndsWith("]")) |
||||
|
{ |
||||
|
propType = propType.ReplaceFirst("[", "").RemovePostFix("]", ""); |
||||
|
} |
||||
|
|
||||
|
if (appModel.Types.TryGetValue(propType, out var propBaseType)) |
||||
|
{ |
||||
|
modelBaseTypes.AddIfNotContains(propType); |
||||
|
modelBaseTypes.AddIfNotContains(FindBaseTypes(appModel, propBaseType)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
modelBaseTypes.AddIfNotContains(returnType); |
||||
|
} |
||||
|
|
||||
|
// 基类导出
|
||||
|
foreach (var baseType in modelBaseTypes) |
||||
|
{ |
||||
|
if (appModel.Types.TryGetValue(baseType, out var modelType)) |
||||
|
{ |
||||
|
var modelTypeName = baseType[(baseType.LastIndexOf('.') + 1)..]; |
||||
|
|
||||
|
Logger.LogInformation($" Generating base model: {modelTypeName} script."); |
||||
|
|
||||
|
modelScriptBuilder.AppendLine(CreateModel(modelTypeName, modelType)); |
||||
|
|
||||
|
Logger.LogInformation($" The base model: {modelTypeName} generate successful."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return modelScriptBuilder.ToString(); |
||||
|
} |
||||
|
|
||||
|
public string CreateScript( |
||||
|
ApplicationApiDescriptionModel appModel, |
||||
|
ModuleApiDescriptionModel apiModel, |
||||
|
ControllerApiDescriptionModel actionModel) |
||||
|
{ |
||||
|
var apiScriptBuilder = new StringBuilder(); |
||||
|
|
||||
|
apiScriptBuilder.AppendLine("import { defAbpHttp } from '/@/utils/http/abp';"); |
||||
|
|
||||
|
var importModel = ""; |
||||
|
|
||||
|
foreach (var action in actionModel.Actions) |
||||
|
{ |
||||
|
foreach (var paramter in action.Value.ParametersOnMethod) |
||||
|
{ |
||||
|
if (appModel.Types.TryGetValue(paramter.Type, out var _)) |
||||
|
{ |
||||
|
var modelTypeName = paramter.Type[(paramter.Type.LastIndexOf('.') + 1)..]; |
||||
|
|
||||
|
if (!importModel.Contains(modelTypeName)) |
||||
|
{ |
||||
|
importModel += modelTypeName + ", "; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var returnType = action.Value.ReturnValue.TypeSimple; |
||||
|
if (!returnType.StartsWith("System")) |
||||
|
{ |
||||
|
var abpBaseType = AbpBaseTypes.FirstOrDefault(basType => returnType.StartsWith(basType)); |
||||
|
if (!abpBaseType.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
returnType = returnType |
||||
|
.Replace(abpBaseType, "") |
||||
|
.Replace("<", "") |
||||
|
.Replace(">", ""); |
||||
|
} |
||||
|
|
||||
|
returnType = ReplaceTypeSimple(returnType); |
||||
|
returnType = returnType[(returnType.LastIndexOf('.') + 1)..]; |
||||
|
if (!importModel.Contains(returnType)) |
||||
|
{ |
||||
|
importModel += returnType + ","; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
importModel = importModel.RemovePostFix(","); |
||||
|
|
||||
|
apiScriptBuilder.AppendLine("import { " + importModel + " } from './model';"); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
apiScriptBuilder.AppendFormat("const remoteServiceName = '{0}';", apiModel.RemoteServiceName); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
apiScriptBuilder.AppendFormat("const controllerName = '{0}';", actionModel.ControllerName); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
|
||||
|
foreach (var action in actionModel.Actions) |
||||
|
{ |
||||
|
apiScriptBuilder.AppendFormat("export const {0} = (", action.Value.UniqueName); |
||||
|
|
||||
|
for (var index = 0; index < action.Value.ParametersOnMethod.Count; index++) |
||||
|
{ |
||||
|
var paramter = action.Value.ParametersOnMethod[index]; |
||||
|
var apiParamCharacter = paramter.IsOptional ? "?:" : ":"; |
||||
|
var apiParamName = paramter.TypeSimple; |
||||
|
apiParamName = apiParamName[(apiParamName.LastIndexOf('.') + 1)..]; |
||||
|
apiScriptBuilder.AppendFormat("{0}{1} {2}", paramter.Name, apiParamCharacter, apiParamName); |
||||
|
|
||||
|
if (index < action.Value.ParametersOnMethod.Count - 1) |
||||
|
{ |
||||
|
apiScriptBuilder.Append(", "); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
apiScriptBuilder.AppendLine(") => {"); |
||||
|
|
||||
|
var apiRequestName = "request"; |
||||
|
var apiRetuanName = action.Value.ReturnValue.TypeSimple; |
||||
|
|
||||
|
if (apiRetuanName.Contains("ListResultDto")) |
||||
|
{ |
||||
|
apiRequestName = "listRequest"; |
||||
|
apiRetuanName = apiRetuanName[(apiRetuanName.IndexOf("<") + 1)..]; |
||||
|
apiRetuanName = apiRetuanName[..^1]; |
||||
|
} |
||||
|
else if (apiRetuanName.Contains("PagedResultDto")) |
||||
|
{ |
||||
|
apiRequestName = "pagedRequest"; |
||||
|
apiRetuanName = apiRetuanName[(apiRetuanName.IndexOf("<") + 1)..]; |
||||
|
apiRetuanName = apiRetuanName[..^1]; |
||||
|
} |
||||
|
|
||||
|
apiRetuanName = apiRetuanName[(apiRetuanName.LastIndexOf('.') + 1)..]; |
||||
|
|
||||
|
if (action.Value.ReturnValue.TypeSimple.Contains("System.")) |
||||
|
{ |
||||
|
apiRetuanName = apiRetuanName.ToLower(); |
||||
|
} |
||||
|
|
||||
|
apiScriptBuilder.AppendFormat(" return defAbpHttp.{0}<{1}>(", apiRequestName, apiRetuanName); |
||||
|
apiScriptBuilder.AppendLine("{"); |
||||
|
apiScriptBuilder.AppendLine(" service: remoteServiceName,"); |
||||
|
apiScriptBuilder.AppendLine(" controller: controllerName,"); |
||||
|
apiScriptBuilder.AppendFormat(" action: '{0}',", action.Value.Name); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
|
||||
|
if (DataInParamMethods.Contains(action.Value.HttpMethod)) |
||||
|
{ |
||||
|
if (action.Value.ParametersOnMethod.Any()) |
||||
|
{ |
||||
|
apiScriptBuilder.AppendLine(" params: {"); |
||||
|
|
||||
|
foreach (var paramter in action.Value.ParametersOnMethod) |
||||
|
{ |
||||
|
apiScriptBuilder.AppendFormat(" {0}: {1},", paramter.Name, paramter.Name); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
} |
||||
|
|
||||
|
apiScriptBuilder.AppendLine(" },"); |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
var inPathParams = action.Value.Parameters.Where(p => p.BindingSourceId == "Path"); |
||||
|
var inBodyParams = action.Value.Parameters.Where(p => p.BindingSourceId == "Body"); |
||||
|
|
||||
|
if (inPathParams.Any()) |
||||
|
{ |
||||
|
apiScriptBuilder.AppendLine(" params: {"); |
||||
|
foreach (var paramter in inPathParams) |
||||
|
{ |
||||
|
apiScriptBuilder.AppendFormat(" {0}: {1},", paramter.Name, paramter.Name); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
} |
||||
|
apiScriptBuilder.AppendLine(" },"); |
||||
|
} |
||||
|
|
||||
|
if (inBodyParams.Any() && |
||||
|
inBodyParams.Count() == 1) |
||||
|
{ |
||||
|
apiScriptBuilder.AppendFormat(" data: {0},", inBodyParams.First().NameOnMethod); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
apiScriptBuilder.AppendLine(" data: {"); |
||||
|
foreach (var paramter in inBodyParams) |
||||
|
{ |
||||
|
apiScriptBuilder.AppendFormat(" {0}: {1},", paramter.Name, paramter.Name); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
} |
||||
|
apiScriptBuilder.AppendLine(" },"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
apiScriptBuilder.AppendLine(" });"); |
||||
|
|
||||
|
apiScriptBuilder.AppendLine("};"); |
||||
|
apiScriptBuilder.AppendLine(""); |
||||
|
} |
||||
|
|
||||
|
return apiScriptBuilder.ToString(); |
||||
|
} |
||||
|
|
||||
|
protected virtual string CreateModel( |
||||
|
string modelName, |
||||
|
TypeApiDescriptionModel model) |
||||
|
{ |
||||
|
var modelBuilder = new StringBuilder(); |
||||
|
|
||||
|
if (model.IsEnum) |
||||
|
{ |
||||
|
modelBuilder.AppendLine($"export enum {modelName} {{"); |
||||
|
for (var index = 0; index < model.EnumNames.Length; index++) |
||||
|
{ |
||||
|
modelBuilder.AppendFormat(" {0} = {1},", model.EnumNames[index], model.EnumValues[index]); |
||||
|
modelBuilder.AppendLine(); |
||||
|
} |
||||
|
|
||||
|
modelBuilder.AppendLine("}"); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
modelBuilder.AppendFormat("export interface {0} ", modelName); |
||||
|
|
||||
|
if (!model.BaseType.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
var baseType = ReplaceAbpBaseType(model.BaseType); |
||||
|
baseType = ReplaceTypeSimple(baseType); |
||||
|
|
||||
|
modelBuilder.AppendFormat("extends {0} ", baseType[(baseType.LastIndexOf('.') + 1)..]); |
||||
|
} |
||||
|
modelBuilder.AppendLine("{"); |
||||
|
|
||||
|
for (var index = 0; index < model.Properties.Length; index++) |
||||
|
{ |
||||
|
modelBuilder.AppendFormat(" {0}", model.Properties[index].Name.ToCamelCase()); |
||||
|
var propCharacter = model.Properties[index].IsRequired ? ": " : "?: "; |
||||
|
var propTypeName = ReplaceTypeSimple(model.Properties[index].TypeSimple); |
||||
|
if (propTypeName.LastIndexOf('.') >= 0) |
||||
|
{ |
||||
|
propTypeName = propTypeName[(propTypeName.LastIndexOf('.') + 1)..]; |
||||
|
} |
||||
|
|
||||
|
modelBuilder.AppendFormat("{0}{1};", propCharacter, ReplaceTypeSimple(propTypeName)); |
||||
|
modelBuilder.AppendLine(""); |
||||
|
} |
||||
|
|
||||
|
modelBuilder.AppendLine("}"); |
||||
|
} |
||||
|
|
||||
|
return modelBuilder.ToString(); |
||||
|
} |
||||
|
|
||||
|
protected virtual List<string> FindBaseTypes(ApplicationApiDescriptionModel apiModel, TypeApiDescriptionModel model) |
||||
|
{ |
||||
|
var types = new List<string>(); |
||||
|
|
||||
|
if (!model.BaseType.IsNullOrWhiteSpace() && |
||||
|
!AbpBaseTypes.Contains(model.BaseType) && |
||||
|
apiModel.Types.TryGetValue(model.BaseType, out var baseType)) |
||||
|
{ |
||||
|
types.Add(model.BaseType); |
||||
|
|
||||
|
types.AddRange(FindBaseTypes(apiModel, baseType)); |
||||
|
} |
||||
|
|
||||
|
return types; |
||||
|
} |
||||
|
|
||||
|
protected virtual List<string> FindBaseTypes(ApplicationApiDescriptionModel apiModel, PropertyApiDescriptionModel model) |
||||
|
{ |
||||
|
var types = new List<string>(); |
||||
|
|
||||
|
var propertityType = ReplaceTypeSimple(model.TypeSimple); |
||||
|
|
||||
|
if (!AbpBaseTypes.Contains(propertityType) && |
||||
|
apiModel.Types.TryGetValue(propertityType, out var baseType)) |
||||
|
{ |
||||
|
types.Add(propertityType); |
||||
|
|
||||
|
types.AddRange(FindBaseTypes(apiModel, baseType)); |
||||
|
} |
||||
|
|
||||
|
return types; |
||||
|
} |
||||
|
|
||||
|
protected virtual string ReplaceTypeSimple(string typeSimple) |
||||
|
{ |
||||
|
typeSimple = typeSimple |
||||
|
.Replace("?", "") |
||||
|
.Replace("<System.String>", "<string>") |
||||
|
.Replace("<System.Guid>", "<string>") |
||||
|
.Replace("<System.Int32>", "<number>") |
||||
|
.Replace("<System.Int64>", "<number>") |
||||
|
.Replace("{string:string}", "Dictionary<string, string>") |
||||
|
.Replace("{number:string}", "Dictionary<number, string>") |
||||
|
.Replace("{string:number}", "Dictionary<string, number>") |
||||
|
.Replace("{string:object}", "Dictionary<string, any>"); |
||||
|
|
||||
|
if (typeSimple.StartsWith("[") && typeSimple.EndsWith("]")) |
||||
|
{ |
||||
|
typeSimple = typeSimple.ReplaceFirst("[", "").RemovePostFix("]", ""); |
||||
|
typeSimple = typeSimple.Replace(typeSimple, $"{typeSimple}[]"); |
||||
|
} |
||||
|
|
||||
|
return typeSimple; |
||||
|
} |
||||
|
|
||||
|
protected virtual string ReplaceAbpBaseType(string typeSimple) |
||||
|
{ |
||||
|
var abpBaseType = AbpBaseTypes.FirstOrDefault(t => t.StartsWith(typeSimple)); |
||||
|
if (abpBaseType.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
return typeSimple; |
||||
|
} |
||||
|
|
||||
|
return abpBaseType[(abpBaseType.LastIndexOf('.') + 1)..]; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,124 @@ |
|||||
|
using Microsoft.Extensions.Logging; |
||||
|
using System; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Cli; |
||||
|
using Volo.Abp.Cli.Http; |
||||
|
using Volo.Abp.Cli.ServiceProxying; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Http.Modeling; |
||||
|
using Volo.Abp.IO; |
||||
|
using Volo.Abp.Json; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Cli.ServiceProxying.TypeScript; |
||||
|
public class TypeScriptServiceProxyGenerator : ServiceProxyGeneratorBase<TypeScriptServiceProxyGenerator>, ITransientDependency |
||||
|
{ |
||||
|
public const string Name = "TS"; |
||||
|
|
||||
|
private readonly ITypeScriptProxyGenerator _typeScriptProxyGenerator; |
||||
|
|
||||
|
public TypeScriptServiceProxyGenerator( |
||||
|
CliHttpClientFactory cliHttpClientFactory, |
||||
|
IJsonSerializer jsonSerializer, |
||||
|
ITypeScriptProxyGenerator typeScriptProxyGenerator) |
||||
|
: base(cliHttpClientFactory, jsonSerializer) |
||||
|
{ |
||||
|
_typeScriptProxyGenerator = typeScriptProxyGenerator; |
||||
|
} |
||||
|
|
||||
|
public async override Task GenerateProxyAsync(Volo.Abp.Cli.ServiceProxying.GenerateProxyArgs args) |
||||
|
{ |
||||
|
var applicationApiDescriptionModel = await GetApplicationApiDescriptionModelAsync(args); |
||||
|
var outputFolderRoot = args.Output; |
||||
|
|
||||
|
foreach (var module in applicationApiDescriptionModel.Modules) |
||||
|
{ |
||||
|
Logger.LogInformation($"Generating model script with remote service: {module.Value.RemoteServiceName}."); |
||||
|
|
||||
|
foreach (var controller in module.Value.Controllers) |
||||
|
{ |
||||
|
Logger.LogInformation($" [{module.Value.RemoteServiceName}], Generating model script with controller: {controller.Value.ControllerName}."); |
||||
|
|
||||
|
var modelScript = _typeScriptProxyGenerator |
||||
|
.CreateModelScript(applicationApiDescriptionModel, controller.Value); |
||||
|
|
||||
|
Logger.LogInformation($" [{module.Value.RemoteServiceName}], {controller.Value.ControllerName} model script generated."); |
||||
|
|
||||
|
var modelScriptPath = Path.Combine( |
||||
|
outputFolderRoot, |
||||
|
module.Value.RemoteServiceName.ToKebabCase(), |
||||
|
controller.Value.ControllerGroupName.ToKebabCase(), |
||||
|
"model"); |
||||
|
|
||||
|
DirectoryHelper.CreateIfNotExists(modelScriptPath); |
||||
|
|
||||
|
var modelScriptFile = Path.Combine(modelScriptPath, "index.ts"); |
||||
|
|
||||
|
Logger.LogInformation($"The model script output file: {modelScriptFile}."); |
||||
|
Logger.LogInformation($"Saving model script: {modelScriptFile}."); |
||||
|
|
||||
|
FileHelper.DeleteIfExists(modelScriptFile); |
||||
|
|
||||
|
await File.AppendAllTextAsync(modelScriptFile, modelScript); |
||||
|
|
||||
|
Logger.LogInformation($"Saved model script: {modelScriptFile} has successful."); |
||||
|
|
||||
|
// api script
|
||||
|
|
||||
|
Logger.LogInformation($" [{module.Value.RemoteServiceName}], Generating api script with controller: {controller.Value.ControllerName}."); |
||||
|
|
||||
|
var apiScript = _typeScriptProxyGenerator.CreateScript( |
||||
|
applicationApiDescriptionModel, |
||||
|
module.Value, |
||||
|
controller.Value); |
||||
|
|
||||
|
Logger.LogInformation($" [{module.Value.RemoteServiceName}], {controller.Value.ControllerName} api script generated."); |
||||
|
|
||||
|
var apiScriptPath = Path.Combine( |
||||
|
outputFolderRoot, |
||||
|
module.Value.RemoteServiceName.ToKebabCase(), |
||||
|
controller.Value.ControllerGroupName.ToKebabCase()); |
||||
|
|
||||
|
DirectoryHelper.CreateIfNotExists(apiScriptPath); |
||||
|
|
||||
|
var apiScriptFile = Path.Combine(apiScriptPath, "index.ts"); |
||||
|
|
||||
|
Logger.LogInformation($"The api script output file: {apiScriptFile}."); |
||||
|
Logger.LogInformation($"Saving api script: {apiScriptFile}."); |
||||
|
|
||||
|
FileHelper.DeleteIfExists(apiScriptFile); |
||||
|
|
||||
|
await File.AppendAllTextAsync(apiScriptFile, apiScript); |
||||
|
|
||||
|
Logger.LogInformation($"Saved api script: {apiScriptFile} has successful."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Logger.LogInformation($"Generate type script proxy has completed."); |
||||
|
} |
||||
|
|
||||
|
protected async override Task<ApplicationApiDescriptionModel> GetApplicationApiDescriptionModelAsync(Volo.Abp.Cli.ServiceProxying.GenerateProxyArgs args) |
||||
|
{ |
||||
|
Check.NotNull(args.Url, nameof(args.Url)); |
||||
|
|
||||
|
var client = CliHttpClientFactory.CreateClient(); |
||||
|
|
||||
|
var url = CliUrls.GetApiDefinitionUrl(args.Url); |
||||
|
var apiDefinitionResult = await client.GetStringAsync(url + "?includeTypes=true"); |
||||
|
var apiDefinition = JsonSerializer.Deserialize<ApplicationApiDescriptionModel>(apiDefinitionResult); |
||||
|
|
||||
|
var moduleDefinition = apiDefinition.Modules.FirstOrDefault(x => string.Equals(x.Key, args.Module, StringComparison.CurrentCultureIgnoreCase)).Value; |
||||
|
if (moduleDefinition == null) |
||||
|
{ |
||||
|
throw new CliUsageException($"Module name: {args.Module} is invalid"); |
||||
|
} |
||||
|
|
||||
|
var apiDescriptionModel = ApplicationApiDescriptionModel.Create(); |
||||
|
apiDescriptionModel.AddModule(moduleDefinition); |
||||
|
apiDescriptionModel.Types = apiDefinition.Types; |
||||
|
|
||||
|
return apiDescriptionModel; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace LINGYUN.Abp.SettingManagement; |
||||
|
|
||||
|
public interface ISettingTestAppService |
||||
|
{ |
||||
|
Task SendTestEmailAsync(SendTestEmailInput input); |
||||
|
} |
||||
|
|
||||
|
public class SendTestEmailInput |
||||
|
{ |
||||
|
[Required] |
||||
|
[EmailAddress] |
||||
|
public string EmailAddress { get; set; } |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,25 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
namespace LY.MicroService.AuthServer.Migrations |
|
||||
{ |
|
||||
public partial class RemoveFieldAvatarUrlWithIdentityUser : Migration |
|
||||
{ |
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropColumn( |
|
||||
name: "AvatarUrl", |
|
||||
table: "AbpUsers"); |
|
||||
} |
|
||||
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.AddColumn<string>( |
|
||||
name: "AvatarUrl", |
|
||||
table: "AbpUsers", |
|
||||
type: "varchar(128)", |
|
||||
maxLength: 128, |
|
||||
nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
File diff suppressed because it is too large
@ -1,26 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace LY.MicroService.AuthServer.Migrations |
|
||||
{ |
|
||||
public partial class UpgradeAbpTo500RC1 : Migration |
|
||||
{ |
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.AddColumn<bool>( |
|
||||
name: "IsActive", |
|
||||
table: "AbpUsers", |
|
||||
type: "tinyint(1)", |
|
||||
nullable: false, |
|
||||
defaultValue: false); |
|
||||
} |
|
||||
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropColumn( |
|
||||
name: "IsActive", |
|
||||
table: "AbpUsers"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,938 +0,0 @@ |
|||||
using System; |
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace LY.MicroService.AuthServer.Migrations |
|
||||
{ |
|
||||
public partial class SwitchIdentityServertotheOpenIddict : Migration |
|
||||
{ |
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiResourceClaims"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiResourceProperties"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiResourceScopes"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiResourceSecrets"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiScopeClaims"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiScopeProperties"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientClaims"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientCorsOrigins"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientGrantTypes"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientIdPRestrictions"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientPostLogoutRedirectUris"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientProperties"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientRedirectUris"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientScopes"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClientSecrets"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerDeviceFlowCodes"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerIdentityResourceClaims"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerIdentityResourceProperties"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerPersistedGrants"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiResources"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerApiScopes"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerClients"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "IdentityServerIdentityResources"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "OpenIddictApplications", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
ClientId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ClientSecret = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConsentType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DisplayName = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DisplayNames = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Permissions = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
PostLogoutRedirectUris = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Properties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
RedirectUris = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Requirements = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ClientUri = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
LogoUri = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_OpenIddictApplications", x => x.Id); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "OpenIddictScopes", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Description = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Descriptions = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DisplayName = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DisplayNames = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Properties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Resources = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_OpenIddictScopes", x => x.Id); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "OpenIddictAuthorizations", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
ApplicationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
Properties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Scopes = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Subject = table.Column<string>(type: "varchar(400)", maxLength: 400, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_OpenIddictAuthorizations", x => x.Id); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_OpenIddictAuthorizations_OpenIddictApplications_ApplicationId", |
|
||||
column: x => x.ApplicationId, |
|
||||
principalTable: "OpenIddictApplications", |
|
||||
principalColumn: "Id"); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "OpenIddictTokens", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
ApplicationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
AuthorizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
ExpirationDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
Payload = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Properties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
RedemptionDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
ReferenceId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Subject = table.Column<string>(type: "varchar(400)", maxLength: 400, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_OpenIddictTokens", x => x.Id); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_OpenIddictTokens_OpenIddictApplications_ApplicationId", |
|
||||
column: x => x.ApplicationId, |
|
||||
principalTable: "OpenIddictApplications", |
|
||||
principalColumn: "Id"); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_OpenIddictTokens_OpenIddictAuthorizations_AuthorizationId", |
|
||||
column: x => x.AuthorizationId, |
|
||||
principalTable: "OpenIddictAuthorizations", |
|
||||
principalColumn: "Id"); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_OpenIddictApplications_ClientId", |
|
||||
table: "OpenIddictApplications", |
|
||||
column: "ClientId"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_OpenIddictAuthorizations_ApplicationId_Status_Subject_Type", |
|
||||
table: "OpenIddictAuthorizations", |
|
||||
columns: new[] { "ApplicationId", "Status", "Subject", "Type" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_OpenIddictScopes_Name", |
|
||||
table: "OpenIddictScopes", |
|
||||
column: "Name"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_OpenIddictTokens_ApplicationId_Status_Subject_Type", |
|
||||
table: "OpenIddictTokens", |
|
||||
columns: new[] { "ApplicationId", "Status", "Subject", "Type" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_OpenIddictTokens_AuthorizationId", |
|
||||
table: "OpenIddictTokens", |
|
||||
column: "AuthorizationId"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_OpenIddictTokens_ReferenceId", |
|
||||
table: "OpenIddictTokens", |
|
||||
column: "ReferenceId"); |
|
||||
} |
|
||||
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropTable( |
|
||||
name: "OpenIddictScopes"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "OpenIddictTokens"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "OpenIddictAuthorizations"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "OpenIddictApplications"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiResources", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
AllowedAccessTokenSigningAlgorithms = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiScopes", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Emphasize = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Required = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiScopes", x => x.Id); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClients", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
AbsoluteRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|
||||
AccessTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|
||||
AccessTokenType = table.Column<int>(type: "int", nullable: false), |
|
||||
AllowAccessTokensViaBrowser = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
AllowOfflineAccess = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
AllowPlainTextPkce = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
AllowRememberConsent = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
AllowedIdentityTokenSigningAlgorithms = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
AlwaysSendClientClaims = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
AuthorizationCodeLifetime = table.Column<int>(type: "int", nullable: false), |
|
||||
BackChannelLogoutSessionRequired = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
BackChannelLogoutUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ClientClaimsPrefix = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ClientName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ClientUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConsentLifetime = table.Column<int>(type: "int", nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DeviceCodeLifetime = table.Column<int>(type: "int", nullable: false), |
|
||||
EnableLocalLogin = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
FrontChannelLogoutSessionRequired = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
FrontChannelLogoutUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
IdentityTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|
||||
IncludeJwtId = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
LogoUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
PairWiseSubjectSalt = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ProtocolType = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
RefreshTokenExpiration = table.Column<int>(type: "int", nullable: false), |
|
||||
RefreshTokenUsage = table.Column<int>(type: "int", nullable: false), |
|
||||
RequireClientSecret = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
RequireConsent = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
RequirePkce = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
RequireRequestObject = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
SlidingRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|
||||
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
UserCodeType = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
UserSsoLifetime = table.Column<int>(type: "int", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClients", x => x.Id); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerDeviceFlowCodes", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
Data = table.Column<string>(type: "varchar(10000)", maxLength: 10000, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Description = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DeviceCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
SessionId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
SubjectId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
UserCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerIdentityResources", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Emphasize = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Required = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|
||||
ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerPersistedGrants", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Key = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
ConsumedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
||||
Data = table.Column<string>(type: "varchar(10000)", maxLength: 10000, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Description = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|
||||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
SessionId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
SubjectId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiResourceClaims", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiResourceClaims", x => new { x.ApiResourceId, x.Type }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerApiResourceClaims_IdentityServerApiResources_A~", |
|
||||
column: x => x.ApiResourceId, |
|
||||
principalTable: "IdentityServerApiResources", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiResourceProperties", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key, x.Value }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResourc~", |
|
||||
column: x => x.ApiResourceId, |
|
||||
principalTable: "IdentityServerApiResources", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiResourceScopes", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Scope = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiResourceScopes", x => new { x.ApiResourceId, x.Scope }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerApiResourceScopes_IdentityServerApiResources_A~", |
|
||||
column: x => x.ApiResourceId, |
|
||||
principalTable: "IdentityServerApiResources", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiResourceSecrets", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiResourceSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerApiResourceSecrets_IdentityServerApiResources_~", |
|
||||
column: x => x.ApiResourceId, |
|
||||
principalTable: "IdentityServerApiResources", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiScopeClaims", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ApiScopeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Type }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScop~", |
|
||||
column: x => x.ApiScopeId, |
|
||||
principalTable: "IdentityServerApiScopes", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerApiScopeProperties", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ApiScopeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerApiScopeProperties", x => new { x.ApiScopeId, x.Key, x.Value }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerApiScopeProperties_IdentityServerApiScopes_Api~", |
|
||||
column: x => x.ApiScopeId, |
|
||||
principalTable: "IdentityServerApiScopes", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientClaims", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Value = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientCorsOrigins", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Origin = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_Client~", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientGrantTypes", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
GrantType = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientIdPRestrictions", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Provider = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_Cl~", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientPostLogoutRedirectUris", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
PostLogoutRedirectUri = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerCli~", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientProperties", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key, x.Value }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientRedirectUris", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
RedirectUri = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_Clien~", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientScopes", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Scope = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerClientSecrets", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Description = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", |
|
||||
column: x => x.ClientId, |
|
||||
principalTable: "IdentityServerClients", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerIdentityResourceClaims", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
IdentityResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerIdentityResourceClaims", x => new { x.IdentityResourceId, x.Type }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerIdentityResourceClaims_IdentityServerIdentityR~", |
|
||||
column: x => x.IdentityResourceId, |
|
||||
principalTable: "IdentityServerIdentityResources", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "IdentityServerIdentityResourceProperties", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
IdentityResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
||||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"), |
|
||||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_IdentityServerIdentityResourceProperties", x => new { x.IdentityResourceId, x.Key, x.Value }); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_IdentityServerIdentityResourceProperties_IdentityServerIdent~", |
|
||||
column: x => x.IdentityResourceId, |
|
||||
principalTable: "IdentityServerIdentityResources", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_IdentityServerClients_ClientId", |
|
||||
table: "IdentityServerClients", |
|
||||
column: "ClientId"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", |
|
||||
table: "IdentityServerDeviceFlowCodes", |
|
||||
column: "DeviceCode", |
|
||||
unique: true); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_IdentityServerDeviceFlowCodes_Expiration", |
|
||||
table: "IdentityServerDeviceFlowCodes", |
|
||||
column: "Expiration"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_IdentityServerDeviceFlowCodes_UserCode", |
|
||||
table: "IdentityServerDeviceFlowCodes", |
|
||||
column: "UserCode"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_IdentityServerPersistedGrants_Expiration", |
|
||||
table: "IdentityServerPersistedGrants", |
|
||||
column: "Expiration"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", |
|
||||
table: "IdentityServerPersistedGrants", |
|
||||
columns: new[] { "SubjectId", "ClientId", "Type" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type", |
|
||||
table: "IdentityServerPersistedGrants", |
|
||||
columns: new[] { "SubjectId", "SessionId", "Type" }); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue