Browse Source
- 增加多数据库启动配置项 - 调整多数据库模式数据库迁移 - 修复部分数据库迁移脚本 - 增加缺少的版本升级数据库迁移 - 增加Quartz的PostgreSql初始化模块 - 调整单体服务启动文档pull/1397/head
78 changed files with 20631 additions and 1597 deletions
@ -0,0 +1,28 @@ |
|||||
|
{ |
||||
|
"profiles": { |
||||
|
"Single.PostgreSql.Dev": { |
||||
|
"commandName": "Project", |
||||
|
"dotnetRunMessages": true, |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development", |
||||
|
"APPLICATION_DATABASE_PROVIDER": "PostgreSql" |
||||
|
} |
||||
|
}, |
||||
|
"Single.MySql.Dev": { |
||||
|
"commandName": "Project", |
||||
|
"dotnetRunMessages": true, |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development", |
||||
|
"APPLICATION_DATABASE_PROVIDER": "MySql" |
||||
|
} |
||||
|
}, |
||||
|
"Single.SqlServer.Dev": { |
||||
|
"commandName": "Project", |
||||
|
"dotnetRunMessages": true, |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development", |
||||
|
"APPLICATION_DATABASE_PROVIDER": "SqlServer" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,5 +1,5 @@ |
|||||
{ |
{ |
||||
"ConnectionStrings": { |
"ConnectionStrings": { |
||||
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" //MySql |
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" |
||||
} |
} |
||||
} |
} |
||||
@ -1,5 +1,5 @@ |
|||||
{ |
{ |
||||
"ConnectionStrings": { |
"ConnectionStrings": { |
||||
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=yourStrong(!)Password;TrustServerCertificate=True" |
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;TrustServerCertificate=True" |
||||
} |
} |
||||
} |
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,43 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.Migrations |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
public partial class UpgradeAbpFrameworkTo936 : Migration |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AlterColumn<Guid>( |
||||
|
name: "EntityId", |
||||
|
table: "Demo_BooksAuths", |
||||
|
type: "char(64)", |
||||
|
maxLength: 64, |
||||
|
nullable: false, |
||||
|
collation: "ascii_general_ci", |
||||
|
oldClrType: typeof(string), |
||||
|
oldType: "char(64)", |
||||
|
oldMaxLength: 64) |
||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "EntityId", |
||||
|
table: "Demo_BooksAuths", |
||||
|
type: "char(64)", |
||||
|
maxLength: 64, |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(Guid), |
||||
|
oldType: "char(64)", |
||||
|
oldMaxLength: 64) |
||||
|
.Annotation("MySql:CharSet", "utf8mb4") |
||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,27 +1,66 @@ |
|||||
using LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql; |
using DotNetCore.CAP; |
||||
|
using LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql; |
||||
|
using LINGYUN.Abp.Quartz.PostgresSqlInstaller; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
using Microsoft.Extensions.DependencyInjection; |
using Microsoft.Extensions.DependencyInjection; |
||||
using System; |
using System; |
||||
|
using Volo.Abp.Data; |
||||
using Volo.Abp.EntityFrameworkCore; |
using Volo.Abp.EntityFrameworkCore; |
||||
using Volo.Abp.EntityFrameworkCore.PostgreSql; |
using Volo.Abp.EntityFrameworkCore.PostgreSql; |
||||
|
using Volo.Abp.Guids; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
|
||||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql; |
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql; |
||||
|
|
||||
[DependsOn( |
[DependsOn( |
||||
typeof(AbpEntityFrameworkCorePostgreSqlModule), |
typeof(AbpEntityFrameworkCorePostgreSqlModule), |
||||
|
typeof(AbpQuartzPostgresSqlInstallerModule), |
||||
typeof(AbpElsaEntityFrameworkCorePostgreSqlModule), |
typeof(AbpElsaEntityFrameworkCorePostgreSqlModule), |
||||
typeof(SingleMigrationsEntityFrameworkCoreModule) |
typeof(SingleMigrationsEntityFrameworkCoreModule) |
||||
)] |
)] |
||||
public class SingleMigrationsEntityFrameworkCorePostgreSqlModule : AbpModule |
public class SingleMigrationsEntityFrameworkCorePostgreSqlModule : AbpModule |
||||
{ |
{ |
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
{ |
{ |
||||
context.Services.AddAbpDbContext<SingleMigrationsDbContext>(); |
var dbProvider = Environment.GetEnvironmentVariable("APPLICATION_DATABASE_PROVIDER"); |
||||
|
if ("PostgreSql".Equals(dbProvider, StringComparison.InvariantCultureIgnoreCase)) |
||||
Configure<AbpDbContextOptions>(options => |
|
||||
{ |
{ |
||||
|
// https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); |
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); |
||||
options.UseNpgsql(); |
|
||||
}); |
var configuration = context.Services.GetConfiguration(); |
||||
|
|
||||
|
PreConfigure<CapOptions>(options => |
||||
|
{ |
||||
|
if (configuration.GetValue<bool>("CAP:IsEnabled")) |
||||
|
{ |
||||
|
options.UsePostgreSql( |
||||
|
sqlOptions => |
||||
|
{ |
||||
|
configuration.GetSection("CAP:PostgreSql").Bind(sqlOptions); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var dbProvider = Environment.GetEnvironmentVariable("APPLICATION_DATABASE_PROVIDER"); |
||||
|
if ("PostgreSql".Equals(dbProvider, StringComparison.InvariantCultureIgnoreCase)) |
||||
|
{ |
||||
|
Configure<AbpDbContextOptions>(options => |
||||
|
{ |
||||
|
options.UseNpgsql(npgsql => npgsql.MigrationsAssembly(GetType().Assembly)); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpSequentialGuidGeneratorOptions>(options => |
||||
|
{ |
||||
|
if (options.DefaultSequentialGuidType == null) |
||||
|
{ |
||||
|
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
File diff suppressed because it is too large
@ -0,0 +1,37 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.SqlServer.Migrations |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
public partial class UpgradeAbpFrameworkTo936 : Migration |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAuditLogExcelFiles", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
FileName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAuditLogExcelFiles", x => x.Id); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAuditLogExcelFiles"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,5 @@ |
|||||
|
{ |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
using LINGYUN.Abp.Demo.Authors; |
||||
|
using LINGYUN.Abp.Demo.Books; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Demo.EntityFrameworkCore; |
||||
|
|
||||
|
[ConnectionStringName(DemoDbProterties.ConnectionStringName)] |
||||
|
public interface IDemoDbContext : IEfCoreDbContext |
||||
|
{ |
||||
|
DbSet<Book> Books { get; } |
||||
|
|
||||
|
DbSet<Author> Authors { get; } |
||||
|
} |
||||
@ -0,0 +1,291 @@ |
|||||
|
-- basic script |
||||
|
|
||||
|
CREATE SCHEMA IF NOT EXISTS "Elsa"; |
||||
|
|
||||
|
SET search_path TO "Elsa"; |
||||
|
|
||||
|
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" ( |
||||
|
"MigrationId" varchar(150) NOT NULL, |
||||
|
"ProductVersion" varchar(32) NOT NULL, |
||||
|
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId") |
||||
|
); |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
CREATE TABLE "Bookmarks" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"TenantId" varchar(255) NULL, |
||||
|
"Hash" varchar(255) NOT NULL, |
||||
|
"Model" text NOT NULL, |
||||
|
"ModelType" text NOT NULL, |
||||
|
"ActivityType" varchar(255) NOT NULL, |
||||
|
"ActivityId" varchar(255) NOT NULL, |
||||
|
"WorkflowInstanceId" varchar(255) NOT NULL, |
||||
|
"CorrelationId" varchar(255) NULL, |
||||
|
CONSTRAINT "PK_Bookmarks" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE "WorkflowDefinitions" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"DefinitionId" varchar(255) NOT NULL, |
||||
|
"TenantId" varchar(255) NULL, |
||||
|
"Name" varchar(255) NULL, |
||||
|
"DisplayName" text NULL, |
||||
|
"Description" text NULL, |
||||
|
"Version" integer NOT NULL, |
||||
|
"IsSingleton" boolean NOT NULL, |
||||
|
"PersistenceBehavior" integer NOT NULL, |
||||
|
"DeleteCompletedInstances" boolean NOT NULL, |
||||
|
"IsPublished" boolean NOT NULL, |
||||
|
"IsLatest" boolean NOT NULL, |
||||
|
"Tag" varchar(255) NULL, |
||||
|
"Data" text NULL, |
||||
|
CONSTRAINT "PK_WorkflowDefinitions" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE "WorkflowExecutionLogRecords" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"TenantId" varchar(255) NULL, |
||||
|
"WorkflowInstanceId" varchar(255) NOT NULL, |
||||
|
"ActivityId" varchar(255) NOT NULL, |
||||
|
"ActivityType" varchar(255) NOT NULL, |
||||
|
"Timestamp" timestamp with time zone NOT NULL, |
||||
|
"EventName" text NULL, |
||||
|
"Message" text NULL, |
||||
|
"Source" text NULL, |
||||
|
"Data" text NULL, |
||||
|
CONSTRAINT "PK_WorkflowExecutionLogRecords" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE "WorkflowInstances" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"DefinitionId" varchar(255) NOT NULL, |
||||
|
"TenantId" varchar(255) NULL, |
||||
|
"Version" integer NOT NULL, |
||||
|
"WorkflowStatus" integer NOT NULL, |
||||
|
"CorrelationId" varchar(255) NULL, |
||||
|
"ContextType" varchar(255) NULL, |
||||
|
"ContextId" varchar(255) NULL, |
||||
|
"Name" varchar(255) NULL, |
||||
|
"CreatedAt" timestamp with time zone NOT NULL, |
||||
|
"LastExecutedAt" timestamp with time zone NULL, |
||||
|
"FinishedAt" timestamp with time zone NULL, |
||||
|
"CancelledAt" timestamp with time zone NULL, |
||||
|
"FaultedAt" timestamp with time zone NULL, |
||||
|
"Data" text NULL, |
||||
|
CONSTRAINT "PK_WorkflowInstances" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
CREATE INDEX "IX_Bookmark_ActivityId" ON "Bookmarks" ("ActivityId"); |
||||
|
CREATE INDEX "IX_Bookmark_ActivityType" ON "Bookmarks" ("ActivityType"); |
||||
|
CREATE INDEX "IX_Bookmark_ActivityType_TenantId_Hash" ON "Bookmarks" ("ActivityType", "TenantId", "Hash"); |
||||
|
CREATE INDEX "IX_Bookmark_CorrelationId" ON "Bookmarks" ("CorrelationId"); |
||||
|
CREATE INDEX "IX_Bookmark_Hash" ON "Bookmarks" ("Hash"); |
||||
|
CREATE INDEX "IX_Bookmark_Hash_CorrelationId_TenantId" ON "Bookmarks" ("Hash", "CorrelationId", "TenantId"); |
||||
|
CREATE INDEX "IX_Bookmark_TenantId" ON "Bookmarks" ("TenantId"); |
||||
|
CREATE INDEX "IX_Bookmark_WorkflowInstanceId" ON "Bookmarks" ("WorkflowInstanceId"); |
||||
|
|
||||
|
CREATE UNIQUE INDEX "IX_WorkflowDefinition_DefinitionId_VersionId" ON "WorkflowDefinitions" ("DefinitionId", "Version"); |
||||
|
CREATE INDEX "IX_WorkflowDefinition_IsLatest" ON "WorkflowDefinitions" ("IsLatest"); |
||||
|
CREATE INDEX "IX_WorkflowDefinition_IsPublished" ON "WorkflowDefinitions" ("IsPublished"); |
||||
|
CREATE INDEX "IX_WorkflowDefinition_Name" ON "WorkflowDefinitions" ("Name"); |
||||
|
CREATE INDEX "IX_WorkflowDefinition_Tag" ON "WorkflowDefinitions" ("Tag"); |
||||
|
CREATE INDEX "IX_WorkflowDefinition_TenantId" ON "WorkflowDefinitions" ("TenantId"); |
||||
|
CREATE INDEX "IX_WorkflowDefinition_Version" ON "WorkflowDefinitions" ("Version"); |
||||
|
|
||||
|
CREATE INDEX "IX_WorkflowExecutionLogRecord_ActivityId" ON "WorkflowExecutionLogRecords" ("ActivityId"); |
||||
|
CREATE INDEX "IX_WorkflowExecutionLogRecord_ActivityType" ON "WorkflowExecutionLogRecords" ("ActivityType"); |
||||
|
CREATE INDEX "IX_WorkflowExecutionLogRecord_TenantId" ON "WorkflowExecutionLogRecords" ("TenantId"); |
||||
|
CREATE INDEX "IX_WorkflowExecutionLogRecord_Timestamp" ON "WorkflowExecutionLogRecords" ("Timestamp"); |
||||
|
CREATE INDEX "IX_WorkflowExecutionLogRecord_WorkflowInstanceId" ON "WorkflowExecutionLogRecords" ("WorkflowInstanceId"); |
||||
|
|
||||
|
CREATE INDEX "IX_WorkflowInstance_ContextId" ON "WorkflowInstances" ("ContextId"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_ContextType" ON "WorkflowInstances" ("ContextType"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_CorrelationId" ON "WorkflowInstances" ("CorrelationId"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_CreatedAt" ON "WorkflowInstances" ("CreatedAt"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_DefinitionId" ON "WorkflowInstances" ("DefinitionId"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_FaultedAt" ON "WorkflowInstances" ("FaultedAt"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_FinishedAt" ON "WorkflowInstances" ("FinishedAt"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_LastExecutedAt" ON "WorkflowInstances" ("LastExecutedAt"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_Name" ON "WorkflowInstances" ("Name"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_TenantId" ON "WorkflowInstances" ("TenantId"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_WorkflowStatus" ON "WorkflowInstances" ("WorkflowStatus"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_WorkflowStatus_DefinitionId" ON "WorkflowInstances" ("WorkflowStatus", "DefinitionId"); |
||||
|
CREATE INDEX "IX_WorkflowInstance_WorkflowStatus_DefinitionId_Version" ON "WorkflowInstances" ("WorkflowStatus", "DefinitionId", "Version"); |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20210523093427_Initial', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
ALTER TABLE "WorkflowInstances" |
||||
|
ALTER COLUMN "CorrelationId" SET DEFAULT '', |
||||
|
ALTER COLUMN "CorrelationId" SET NOT NULL; |
||||
|
|
||||
|
ALTER TABLE "WorkflowInstances" ADD "LastExecutedActivityId" text NULL; |
||||
|
|
||||
|
ALTER TABLE "WorkflowDefinitions" ADD "OutputStorageProviderName" text NULL; |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20210611200027_Update21', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
ALTER TABLE "WorkflowDefinitions" DROP COLUMN "OutputStorageProviderName"; |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20210923112211_Update23', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
ALTER TABLE "WorkflowInstances" ADD "DefinitionVersionId" text NOT NULL; |
||||
|
|
||||
|
ALTER TABLE "Bookmarks" |
||||
|
ALTER COLUMN "CorrelationId" SET DEFAULT '', |
||||
|
ALTER COLUMN "CorrelationId" SET NOT NULL; |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20211215100204_Update24', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
ALTER TABLE "WorkflowInstances" |
||||
|
ALTER COLUMN "DefinitionVersionId" TYPE varchar(255); |
||||
|
|
||||
|
CREATE INDEX "IX_WorkflowInstance_DefinitionVersionId" ON "WorkflowInstances" ("DefinitionVersionId"); |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20220120170050_Update241', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
CREATE TABLE "Triggers" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"TenantId" varchar(255) NULL, |
||||
|
"Hash" varchar(255) NOT NULL, |
||||
|
"Model" text NOT NULL, |
||||
|
"ModelType" text NOT NULL, |
||||
|
"ActivityType" varchar(255) NOT NULL, |
||||
|
"ActivityId" varchar(255) NOT NULL, |
||||
|
"WorkflowDefinitionId" varchar(255) NOT NULL, |
||||
|
CONSTRAINT "PK_Triggers" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
CREATE INDEX "IX_Trigger_ActivityId" ON "Triggers" ("ActivityId"); |
||||
|
CREATE INDEX "IX_Trigger_ActivityType" ON "Triggers" ("ActivityType"); |
||||
|
CREATE INDEX "IX_Trigger_ActivityType_TenantId_Hash" ON "Triggers" ("ActivityType", "TenantId", "Hash"); |
||||
|
CREATE INDEX "IX_Trigger_Hash" ON "Triggers" ("Hash"); |
||||
|
CREATE INDEX "IX_Trigger_Hash_TenantId" ON "Triggers" ("Hash", "TenantId"); |
||||
|
CREATE INDEX "IX_Trigger_TenantId" ON "Triggers" ("TenantId"); |
||||
|
CREATE INDEX "IX_Trigger_WorkflowDefinitionId" ON "Triggers" ("WorkflowDefinitionId"); |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20220120204150_Update25', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
ALTER TABLE "WorkflowDefinitions" ADD "CreatedAt" timestamp with time zone NOT NULL DEFAULT '0001-01-01 00:00:00'; |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20220512203646_Update28', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
|
||||
|
-- webhooks |
||||
|
|
||||
|
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" ( |
||||
|
"MigrationId" varchar(150) NOT NULL, |
||||
|
"ProductVersion" varchar(32) NOT NULL, |
||||
|
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId") |
||||
|
); |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
CREATE TABLE "WebhookDefinitions" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"TenantId" varchar(255) NULL, |
||||
|
"Name" varchar(255) NOT NULL, |
||||
|
"Path" varchar(255) NOT NULL, |
||||
|
"Description" varchar(255) NULL, |
||||
|
"PayloadTypeName" varchar(255) NULL, |
||||
|
"IsEnabled" boolean NOT NULL, |
||||
|
CONSTRAINT "PK_WebhookDefinitions" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
CREATE INDEX "IX_WebhookDefinition_Description" ON "WebhookDefinitions" ("Description"); |
||||
|
CREATE INDEX "IX_WebhookDefinition_IsEnabled" ON "WebhookDefinitions" ("IsEnabled"); |
||||
|
CREATE INDEX "IX_WebhookDefinition_Name" ON "WebhookDefinitions" ("Name"); |
||||
|
CREATE INDEX "IX_WebhookDefinition_Path" ON "WebhookDefinitions" ("Path"); |
||||
|
CREATE INDEX "IX_WebhookDefinition_PayloadTypeName" ON "WebhookDefinitions" ("PayloadTypeName"); |
||||
|
CREATE INDEX "IX_WebhookDefinition_TenantId" ON "WebhookDefinitions" ("TenantId"); |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20210604065041_Initial', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
|
||||
|
-- workflow-settings |
||||
|
|
||||
|
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" ( |
||||
|
"MigrationId" varchar(150) NOT NULL, |
||||
|
"ProductVersion" varchar(32) NOT NULL, |
||||
|
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId") |
||||
|
); |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
CREATE TABLE "WorkflowSettings" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"WorkflowBlueprintId" varchar(255) NULL, |
||||
|
"Key" varchar(255) NULL, |
||||
|
"Value" varchar(255) NULL, |
||||
|
CONSTRAINT "PK_WorkflowSettings" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
CREATE INDEX "IX_WorkflowSetting_Key" ON "WorkflowSettings" ("Key"); |
||||
|
CREATE INDEX "IX_WorkflowSetting_Value" ON "WorkflowSettings" ("Value"); |
||||
|
CREATE INDEX "IX_WorkflowSetting_WorkflowBlueprintId" ON "WorkflowSettings" ("WorkflowBlueprintId"); |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20210730112043_Initial', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
|
|
||||
|
|
||||
|
-- secrets |
||||
|
|
||||
|
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" ( |
||||
|
"MigrationId" varchar(150) NOT NULL, |
||||
|
"ProductVersion" varchar(32) NOT NULL, |
||||
|
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId") |
||||
|
); |
||||
|
|
||||
|
START TRANSACTION; |
||||
|
|
||||
|
CREATE TABLE "Secrets" ( |
||||
|
"Id" varchar(255) NOT NULL, |
||||
|
"Type" text NOT NULL, |
||||
|
"Name" text NOT NULL, |
||||
|
"DisplayName" text NULL, |
||||
|
"Data" text NULL, |
||||
|
CONSTRAINT "PK_Secrets" PRIMARY KEY ("Id") |
||||
|
); |
||||
|
|
||||
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") |
||||
|
VALUES ('20230709045349_Initial', '5.0.10'); |
||||
|
|
||||
|
COMMIT; |
||||
@ -0,0 +1,143 @@ |
|||||
|
using LINGYUN.Abp.Elsa.EntityFrameworkCore.Migrations; |
||||
|
using Microsoft.Extensions.FileProviders; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Microsoft.Extensions.Logging.Abstractions; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Npgsql; |
||||
|
using NpgsqlTypes; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql.Migrations; |
||||
|
|
||||
|
public class PostgreSqlElsaDataBaseInstaller : IElsaDataBaseInstaller, ITransientDependency |
||||
|
{ |
||||
|
public ILogger<PostgreSqlElsaDataBaseInstaller> Logger { protected get; set; } |
||||
|
|
||||
|
private readonly IVirtualFileProvider _virtualFileProvider; |
||||
|
private readonly IConnectionStringResolver _connectionStringResolver; |
||||
|
|
||||
|
private readonly AbpElsaDataBaseInstallerOptions _installerOptions; |
||||
|
|
||||
|
public PostgreSqlElsaDataBaseInstaller( |
||||
|
IVirtualFileProvider virtualFileProvider, |
||||
|
IConnectionStringResolver connectionStringResolver, |
||||
|
IOptions<AbpElsaDataBaseInstallerOptions> installerOptions) |
||||
|
{ |
||||
|
_installerOptions = installerOptions.Value; |
||||
|
_virtualFileProvider = virtualFileProvider; |
||||
|
_connectionStringResolver = connectionStringResolver; |
||||
|
|
||||
|
Logger = NullLogger<PostgreSqlElsaDataBaseInstaller>.Instance; |
||||
|
} |
||||
|
|
||||
|
public async virtual Task InstallAsync() |
||||
|
{ |
||||
|
var connectionString = await _connectionStringResolver.ResolveAsync("Workflow"); |
||||
|
if (connectionString.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
Logger.LogWarning("Please configure the `Workflow` database connection string Workflow!"); |
||||
|
throw new ArgumentNullException(nameof(connectionString)); |
||||
|
} |
||||
|
|
||||
|
var builder = new NpgsqlConnectionStringBuilder(connectionString); |
||||
|
|
||||
|
var dataBaseName = await CreateDataBaseIfNotExists(builder.Database, builder); |
||||
|
|
||||
|
builder.Database = dataBaseName; |
||||
|
|
||||
|
using var npgsqlConnection = new NpgsqlConnection(builder.ConnectionString); |
||||
|
|
||||
|
if (npgsqlConnection.State == ConnectionState.Closed) |
||||
|
{ |
||||
|
await npgsqlConnection.OpenAsync(); |
||||
|
} |
||||
|
|
||||
|
var tableParams = _installerOptions.InstallTables.Select((_, index) => $"@Table_{index}").JoinAsString(","); |
||||
|
// ElsaContext中默认使用Elsa作为默认Schema
|
||||
|
using (var npgsqlCommand = new NpgsqlCommand($"SELECT COUNT(1) FROM information_schema.tables WHERE table_catalog = @DataBaseName AND table_schema = 'Elsa' AND table_name IN ({tableParams});", npgsqlConnection)) |
||||
|
{ |
||||
|
npgsqlCommand.Parameters.Add("@DataBaseName", NpgsqlDbType.Text).Value = dataBaseName; |
||||
|
for (var index = 0; index < _installerOptions.InstallTables.Count; index++) |
||||
|
{ |
||||
|
npgsqlCommand.Parameters.Add($"@Table_{index}", NpgsqlDbType.Text).Value = _installerOptions.InstallTables[index]; |
||||
|
} |
||||
|
|
||||
|
var rowsAffects = await npgsqlCommand.ExecuteScalarAsync() as long?; |
||||
|
if (rowsAffects > 0) |
||||
|
{ |
||||
|
Logger.LogInformation($"The `{dataBaseName}` database has already exists."); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var sqlScript = await GetInitSqlScript(); |
||||
|
|
||||
|
// ${DataBase} 替换
|
||||
|
sqlScript = sqlScript.ReplaceFirst("${DataBase}", dataBaseName); |
||||
|
|
||||
|
using (var npgsqlCommand = new NpgsqlCommand(sqlScript, npgsqlConnection)) |
||||
|
{ |
||||
|
Logger.LogInformation("The database initialization script `Initial.sql` starts..."); |
||||
|
|
||||
|
await npgsqlCommand.ExecuteNonQueryAsync(); |
||||
|
} |
||||
|
|
||||
|
Logger.LogInformation("Database initialization script `Initial.sql` complete!"); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<string> CreateDataBaseIfNotExists(string dataBase, NpgsqlConnectionStringBuilder connectionStringBuilder) |
||||
|
{ |
||||
|
// 切换主数据库查询数据库是否存在
|
||||
|
connectionStringBuilder.Database = "postgres"; |
||||
|
using var npgsqlConnection = new NpgsqlConnection(connectionStringBuilder.ConnectionString); |
||||
|
if (npgsqlConnection.State == ConnectionState.Closed) |
||||
|
{ |
||||
|
await npgsqlConnection.OpenAsync(); |
||||
|
} |
||||
|
|
||||
|
var checkDataBaseName = ""; |
||||
|
using (var npgsqlCommand = new NpgsqlCommand("SELECT datname FROM pg_database WHERE datname = @DataBaseName;", npgsqlConnection)) |
||||
|
{ |
||||
|
var dataBaseParamter = npgsqlCommand.Parameters.Add("DataBaseName", NpgsqlDbType.Text); |
||||
|
dataBaseParamter.Value = dataBase; |
||||
|
|
||||
|
checkDataBaseName = await npgsqlCommand.ExecuteScalarAsync() as string; |
||||
|
} |
||||
|
|
||||
|
if (checkDataBaseName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
using (var npgsqlCommand = new NpgsqlCommand($"CREATE DATABASE \"{dataBase}\" ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';", npgsqlConnection)) |
||||
|
{ |
||||
|
await npgsqlCommand.ExecuteNonQueryAsync(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return dataBase; |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<string> GetInitSqlScript() |
||||
|
{ |
||||
|
var sqlScriptFileInfo = _virtualFileProvider.GetFileInfo("/LINGYUN/Abp/Elsa/EntityFrameworkCore/PostgreSql/Migrations/Initial.sql"); |
||||
|
if (!sqlScriptFileInfo.Exists || sqlScriptFileInfo.IsDirectory) |
||||
|
{ |
||||
|
Logger.LogWarning("Please Check that the `Initial.sql` file exists!"); |
||||
|
throw new InvalidOperationException("The `Initial.sql` database initialization script file does not exist or is not valid!"); |
||||
|
} |
||||
|
|
||||
|
var sqlScript = await sqlScriptFileInfo.ReadAsStringAsync(); |
||||
|
if (sqlScript.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
Logger.LogWarning("The contents of the `Initial.sql` file are empty or invalid!"); |
||||
|
throw new InvalidOperationException("The contents of the `Initial.sql` file are empty or invalid!"); |
||||
|
} |
||||
|
|
||||
|
return sqlScript; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> |
||||
|
<AssemblyName>LINGYUN.Abp.Quartz.PostgresInstaller</AssemblyName> |
||||
|
<PackageId>LINGYUN.Abp.Quartz.PostgresInstaller</PackageId> |
||||
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<None Remove="LINGYUN\Abp\Quartz\PostgresSqlInstaller\Scripts\Initial.sql" /> |
||||
|
<EmbeddedResource Include="LINGYUN\Abp\Quartz\PostgresSqlInstaller\Scripts\Initial.sql" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.VirtualFileSystem" /> |
||||
|
<PackageReference Include="Npgsql" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.Quartz.SqlInstaller\LINGYUN.Abp.Quartz.SqlInstaller.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,22 @@ |
|||||
|
using LINGYUN.Abp.Quartz.SqlInstaller; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Quartz.PostgresSqlInstaller; |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpQuartzSqlInstallerModule), |
||||
|
typeof(AbpVirtualFileSystemModule))] |
||||
|
public class AbpQuartzPostgresSqlInstallerModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<AbpQuartzPostgresSqlInstallerModule>(); |
||||
|
}); |
||||
|
|
||||
|
context.Services.AddTransient<IQuartzSqlInstaller, PostgresSqlQuartzSqlInstaller>(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,189 @@ |
|||||
|
using LINGYUN.Abp.Quartz.SqlInstaller; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.FileProviders; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Microsoft.Extensions.Logging.Abstractions; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Npgsql; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Quartz; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
using static Quartz.SchedulerBuilder; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Quartz.PostgresSqlInstaller; |
||||
|
|
||||
|
public class PostgresSqlQuartzSqlInstaller : IQuartzSqlInstaller |
||||
|
{ |
||||
|
public ILogger<PostgresSqlQuartzSqlInstaller> Logger { protected get; set; } |
||||
|
|
||||
|
private readonly IVirtualFileProvider _virtualFileProvider; |
||||
|
private readonly AbpQuartzSqlInstallerOptions _installerOptions; |
||||
|
private readonly AbpQuartzOptions _quartzOptions; |
||||
|
private readonly IConfiguration _configuration; |
||||
|
|
||||
|
public PostgresSqlQuartzSqlInstaller( |
||||
|
IConfiguration configuration, |
||||
|
IVirtualFileProvider virtualFileProvider, |
||||
|
IOptions<AbpQuartzOptions> quartzOptions, |
||||
|
IOptions<AbpQuartzSqlInstallerOptions> installerOptions) |
||||
|
{ |
||||
|
_configuration = configuration; |
||||
|
_quartzOptions = quartzOptions.Value; |
||||
|
_virtualFileProvider = virtualFileProvider; |
||||
|
_installerOptions = installerOptions.Value; |
||||
|
|
||||
|
Logger = NullLogger<PostgresSqlQuartzSqlInstaller>.Instance; |
||||
|
} |
||||
|
|
||||
|
public bool CanInstall(string driverDelegateType) |
||||
|
{ |
||||
|
return "Quartz.Impl.AdoJobStore.PostgreSQLDelegate,Quartz".Equals(driverDelegateType); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task InstallAsync() |
||||
|
{ |
||||
|
var dataSource = _quartzOptions.Properties["quartz.jobStore.dataSource"] ?? AdoProviderOptions.DefaultDataSourceName; |
||||
|
|
||||
|
var connectionString = _quartzOptions.Properties[$"quartz.dataSource.{dataSource}.connectionString"]; |
||||
|
var connectionStringName = _quartzOptions.Properties[$"quartz.dataSource.{dataSource}.connectionStringName"]; |
||||
|
if (connectionString.IsNullOrWhiteSpace() && !connectionStringName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
connectionString = _configuration.GetConnectionString(connectionStringName); |
||||
|
} |
||||
|
var tablePrefix = _quartzOptions.Properties["quartz.jobStore.tablePrefix"] ?? "QRTZ_"; |
||||
|
|
||||
|
if (connectionString.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
Logger.LogWarning($"Please configure the `{dataSource}` database connection string in `quartz.jobStore.dataSource`!"); |
||||
|
throw new ArgumentNullException(nameof(connectionString)); |
||||
|
} |
||||
|
|
||||
|
Logger.LogInformation("Install Quartz PostgreSQL..."); |
||||
|
|
||||
|
var builder = new NpgsqlConnectionStringBuilder(connectionString); |
||||
|
|
||||
|
var dataBaseName = await CreateDataBaseIfNotExists(builder.Database, builder); |
||||
|
|
||||
|
builder.Database = dataBaseName; |
||||
|
|
||||
|
using var connection = new NpgsqlConnection(builder.ConnectionString); |
||||
|
|
||||
|
if (connection.State == ConnectionState.Closed) |
||||
|
{ |
||||
|
await connection.OpenAsync(); |
||||
|
} |
||||
|
|
||||
|
// 检查表是否存在
|
||||
|
var tableParams = _installerOptions.InstallTables.Select((_, index) => $"@Table_{index}").JoinAsString(","); |
||||
|
using (var command = new NpgsqlCommand($@"
|
||||
|
SELECT COUNT(*) FROM information_schema.tables |
||||
|
WHERE table_catalog = @DataBaseName |
||||
|
AND table_schema = 'public' |
||||
|
AND table_name IN ({tableParams});", connection))
|
||||
|
{ |
||||
|
command.Parameters.AddWithValue("@DataBaseName", dataBaseName); |
||||
|
|
||||
|
for (var index = 0; index < _installerOptions.InstallTables.Count; index++) |
||||
|
{ |
||||
|
command.Parameters.AddWithValue($"@Table_{index}", $"{tablePrefix}{_installerOptions.InstallTables[index]}"); |
||||
|
} |
||||
|
|
||||
|
var rowsAffects = await command.ExecuteScalarAsync() as long?; |
||||
|
if (rowsAffects > 0) |
||||
|
{ |
||||
|
Logger.LogInformation($"The `{dataBaseName}` tables has already exists."); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var sqlScript = await GetInitSqlScript(); |
||||
|
|
||||
|
// 替换表前缀
|
||||
|
sqlScript = sqlScript.Replace("${TablePrefix}", tablePrefix); |
||||
|
|
||||
|
// 分割 SQL 脚本,PostgreSQL 需要逐条执行
|
||||
|
var sqlCommands = sqlScript.Split(';', StringSplitOptions.RemoveEmptyEntries); |
||||
|
|
||||
|
using var transaction = await connection.BeginTransactionAsync(); |
||||
|
try |
||||
|
{ |
||||
|
foreach (var sqlCommandText in sqlCommands.Where(s => !string.IsNullOrWhiteSpace(s))) |
||||
|
{ |
||||
|
using var command = new NpgsqlCommand(sqlCommandText.Trim(), connection, transaction); |
||||
|
Logger.LogDebug($"Executing SQL: {sqlCommandText.Trim().Substring(0, Math.Min(100, sqlCommandText.Trim().Length))}..."); |
||||
|
await command.ExecuteNonQueryAsync(); |
||||
|
} |
||||
|
|
||||
|
await transaction.CommitAsync(); |
||||
|
Logger.LogInformation("Database initialization script `Initial.sql` complete!"); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
await transaction.RollbackAsync(); |
||||
|
Logger.LogError(ex, "Failed to execute database initialization script!"); |
||||
|
throw; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<string> CreateDataBaseIfNotExists(string dataBase, NpgsqlConnectionStringBuilder connectionStringBuilder) |
||||
|
{ |
||||
|
// PostgreSQL 切换到 template1 数据库来创建新数据库
|
||||
|
var originalDatabase = connectionStringBuilder.Database; |
||||
|
// 使用 postgres 系统数据库
|
||||
|
connectionStringBuilder.Database = "postgres"; |
||||
|
|
||||
|
using var connection = new NpgsqlConnection(connectionStringBuilder.ConnectionString); |
||||
|
if (connection.State == ConnectionState.Closed) |
||||
|
{ |
||||
|
await connection.OpenAsync(); |
||||
|
} |
||||
|
|
||||
|
// 检查数据库是否存在
|
||||
|
using (var command = new NpgsqlCommand( |
||||
|
"SELECT 1 FROM pg_database WHERE datname = @DataBaseName;", connection)) |
||||
|
{ |
||||
|
command.Parameters.AddWithValue("@DataBaseName", dataBase); |
||||
|
var exists = await command.ExecuteScalarAsync() != null; |
||||
|
|
||||
|
if (!exists) |
||||
|
{ |
||||
|
// 创建数据库
|
||||
|
using var createCommand = new NpgsqlCommand( |
||||
|
$"CREATE DATABASE \"{dataBase}\" ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TEMPLATE = template0;", |
||||
|
connection); |
||||
|
|
||||
|
await createCommand.ExecuteNonQueryAsync(); |
||||
|
Logger.LogInformation($"Database `{dataBase}` created successfully."); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 恢复原始数据库连接
|
||||
|
connectionStringBuilder.Database = originalDatabase; |
||||
|
|
||||
|
return dataBase; |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<string> GetInitSqlScript() |
||||
|
{ |
||||
|
// 获取数据库初始化脚本
|
||||
|
var sqlScriptFileInfo = _virtualFileProvider.GetFileInfo("/LINGYUN/Abp/Quartz/PostgresSqlInstaller/Scripts/Initial.sql"); |
||||
|
if (!sqlScriptFileInfo.Exists || sqlScriptFileInfo.IsDirectory) |
||||
|
{ |
||||
|
Logger.LogWarning("Please Check that the `Initial.sql` file exists!"); |
||||
|
throw new InvalidOperationException("The `Initial.sql` database initialization script file does not exist or is not valid!"); |
||||
|
} |
||||
|
|
||||
|
var sqlScript = await sqlScriptFileInfo.ReadAsStringAsync(); |
||||
|
if (sqlScript.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
Logger.LogWarning("The contents of the `Initial.sql` file are empty or invalid!"); |
||||
|
throw new InvalidOperationException("The contents of the `Initial.sql` file are empty or invalid!"); |
||||
|
} |
||||
|
|
||||
|
return sqlScript; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,180 @@ |
|||||
|
-- This script is for PostgreSQL |
||||
|
|
||||
|
-- This initializes the database to pristine for Quartz, by first removing any existing Quartz tables |
||||
|
-- and then recreating them from scratch. |
||||
|
-- Should you only require it to create the tables, set DropDb to 0. |
||||
|
|
||||
|
SET client_min_messages = WARNING; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}fired_triggers; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}paused_trigger_grps; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}scheduler_state; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}locks; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}simprop_triggers; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}simple_triggers; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}cron_triggers; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}blob_triggers; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}triggers; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}job_details; |
||||
|
DROP TABLE IF EXISTS ${TablePrefix}calendars; |
||||
|
SET client_min_messages = NOTICE; |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}job_details |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
job_name TEXT NOT NULL, |
||||
|
job_group TEXT NOT NULL, |
||||
|
description TEXT NULL, |
||||
|
job_class_name TEXT NOT NULL, |
||||
|
is_durable BOOL NOT NULL, |
||||
|
is_nonconcurrent BOOL NOT NULL, |
||||
|
is_update_data BOOL NOT NULL, |
||||
|
requests_recovery BOOL NOT NULL, |
||||
|
job_data BYTEA NULL, |
||||
|
PRIMARY KEY (sched_name, job_name, job_group) |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}triggers |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
trigger_name TEXT NOT NULL, |
||||
|
trigger_group TEXT NOT NULL, |
||||
|
job_name TEXT NOT NULL, |
||||
|
job_group TEXT NOT NULL, |
||||
|
description TEXT NULL, |
||||
|
next_fire_time BIGINT NULL, |
||||
|
prev_fire_time BIGINT NULL, |
||||
|
priority INTEGER NULL, |
||||
|
trigger_state TEXT NOT NULL, |
||||
|
trigger_type TEXT NOT NULL, |
||||
|
start_time BIGINT NOT NULL, |
||||
|
end_time BIGINT NULL, |
||||
|
calendar_name TEXT NULL, |
||||
|
misfire_instr SMALLINT NULL, |
||||
|
job_data BYTEA NULL, |
||||
|
PRIMARY KEY (sched_name, trigger_name, trigger_group), |
||||
|
FOREIGN KEY (sched_name, job_name, job_group) |
||||
|
REFERENCES ${TablePrefix}job_details (sched_name, job_name, job_group) |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}simple_triggers |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
trigger_name TEXT NOT NULL, |
||||
|
trigger_group TEXT NOT NULL, |
||||
|
repeat_count BIGINT NOT NULL, |
||||
|
repeat_interval BIGINT NOT NULL, |
||||
|
times_triggered BIGINT NOT NULL, |
||||
|
PRIMARY KEY (sched_name, trigger_name, trigger_group), |
||||
|
FOREIGN KEY (sched_name, trigger_name, trigger_group) |
||||
|
REFERENCES ${TablePrefix}triggers (sched_name, trigger_name, trigger_group) |
||||
|
ON DELETE CASCADE |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}simprop_triggers |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
trigger_name TEXT NOT NULL, |
||||
|
trigger_group TEXT NOT NULL, |
||||
|
str_prop_1 TEXT NULL, |
||||
|
str_prop_2 TEXT NULL, |
||||
|
str_prop_3 TEXT NULL, |
||||
|
int_prop_1 INTEGER NULL, |
||||
|
int_prop_2 INTEGER NULL, |
||||
|
long_prop_1 BIGINT NULL, |
||||
|
long_prop_2 BIGINT NULL, |
||||
|
dec_prop_1 NUMERIC NULL, |
||||
|
dec_prop_2 NUMERIC NULL, |
||||
|
bool_prop_1 BOOL NULL, |
||||
|
bool_prop_2 BOOL NULL, |
||||
|
time_zone_id TEXT NULL, |
||||
|
PRIMARY KEY (sched_name, trigger_name, trigger_group), |
||||
|
FOREIGN KEY (sched_name, trigger_name, trigger_group) |
||||
|
REFERENCES ${TablePrefix}triggers (sched_name, trigger_name, trigger_group) |
||||
|
ON DELETE CASCADE |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}cron_triggers |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
trigger_name TEXT NOT NULL, |
||||
|
trigger_group TEXT NOT NULL, |
||||
|
cron_expression TEXT NOT NULL, |
||||
|
time_zone_id TEXT, |
||||
|
PRIMARY KEY (sched_name, trigger_name, trigger_group), |
||||
|
FOREIGN KEY (sched_name, trigger_name, trigger_group) |
||||
|
REFERENCES ${TablePrefix}triggers (sched_name, trigger_name, trigger_group) |
||||
|
ON DELETE CASCADE |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}blob_triggers |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
trigger_name TEXT NOT NULL, |
||||
|
trigger_group TEXT NOT NULL, |
||||
|
blob_data BYTEA NULL, |
||||
|
PRIMARY KEY (sched_name, trigger_name, trigger_group), |
||||
|
FOREIGN KEY (sched_name, trigger_name, trigger_group) |
||||
|
REFERENCES ${TablePrefix}triggers (sched_name, trigger_name, trigger_group) |
||||
|
ON DELETE CASCADE |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}calendars |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
calendar_name TEXT NOT NULL, |
||||
|
calendar BYTEA NOT NULL, |
||||
|
PRIMARY KEY (sched_name, calendar_name) |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}paused_trigger_grps |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
trigger_group TEXT NOT NULL, |
||||
|
PRIMARY KEY (sched_name, trigger_group) |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}fired_triggers |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
entry_id TEXT NOT NULL, |
||||
|
trigger_name TEXT NOT NULL, |
||||
|
trigger_group TEXT NOT NULL, |
||||
|
instance_name TEXT NOT NULL, |
||||
|
fired_time BIGINT NOT NULL, |
||||
|
sched_time BIGINT NOT NULL, |
||||
|
priority INTEGER NOT NULL, |
||||
|
state TEXT NOT NULL, |
||||
|
job_name TEXT NULL, |
||||
|
job_group TEXT NULL, |
||||
|
is_nonconcurrent BOOL NOT NULL, |
||||
|
requests_recovery BOOL NULL, |
||||
|
PRIMARY KEY (sched_name, entry_id) |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}scheduler_state |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
instance_name TEXT NOT NULL, |
||||
|
last_checkin_time BIGINT NOT NULL, |
||||
|
checkin_interval BIGINT NOT NULL, |
||||
|
PRIMARY KEY (sched_name, instance_name) |
||||
|
); |
||||
|
|
||||
|
CREATE TABLE ${TablePrefix}locks |
||||
|
( |
||||
|
sched_name TEXT NOT NULL, |
||||
|
lock_name TEXT NOT NULL, |
||||
|
PRIMARY KEY (sched_name, lock_name) |
||||
|
); |
||||
|
|
||||
|
CREATE INDEX idx_${TablePrefix}j_req_recovery ON ${TablePrefix}job_details (requests_recovery); |
||||
|
CREATE INDEX idx_${TablePrefix}t_next_fire_time ON ${TablePrefix}triggers (next_fire_time); |
||||
|
CREATE INDEX idx_${TablePrefix}t_state ON ${TablePrefix}triggers (trigger_state); |
||||
|
CREATE INDEX idx_${TablePrefix}t_nft_st ON ${TablePrefix}triggers (next_fire_time, trigger_state); |
||||
|
CREATE INDEX idx_${TablePrefix}ft_trig_name ON ${TablePrefix}fired_triggers (trigger_name); |
||||
|
CREATE INDEX idx_${TablePrefix}ft_trig_group ON ${TablePrefix}fired_triggers (trigger_group); |
||||
|
CREATE INDEX idx_${TablePrefix}ft_trig_nm_gp ON ${TablePrefix}fired_triggers (sched_name, trigger_name, trigger_group); |
||||
|
CREATE INDEX idx_${TablePrefix}ft_trig_inst_name ON ${TablePrefix}fired_triggers (instance_name); |
||||
|
CREATE INDEX idx_${TablePrefix}ft_job_name ON ${TablePrefix}fired_triggers (job_name); |
||||
|
CREATE INDEX idx_${TablePrefix}ft_job_group ON ${TablePrefix}fired_triggers (job_group); |
||||
|
CREATE INDEX idx_${TablePrefix}ft_job_req_recovery ON ${TablePrefix}fired_triggers (requests_recovery); |
||||
@ -0,0 +1,63 @@ |
|||||
|
{ |
||||
|
"CAP": { |
||||
|
"MySql": { |
||||
|
"TableNamePrefix": "pt_event", |
||||
|
"ConnectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" |
||||
|
} |
||||
|
}, |
||||
|
"Quartz": { |
||||
|
"UsePersistentStore": true, |
||||
|
"Properties": { |
||||
|
"quartz.jobStore.dataSource": "tkm", |
||||
|
"quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX,Quartz", |
||||
|
"quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.MySQLDelegate,Quartz", |
||||
|
"quartz.dataSource.tkm.connectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"quartz.dataSource.tkm.connectionStringName": "Default", |
||||
|
"quartz.dataSource.tkm.provider": "MySqlConnector", |
||||
|
"quartz.jobStore.clustered": "true", |
||||
|
"quartz.serializer.type": "json" |
||||
|
} |
||||
|
}, |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"AbpSaas": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"AbpTenantManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", |
||||
|
"Workflow": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" |
||||
|
}, |
||||
|
"Elsa": { |
||||
|
"Features": { |
||||
|
"DefaultPersistence": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"MySql": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"Webhooks": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"MySql": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"WorkflowSettings": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"MySql": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,63 @@ |
|||||
|
{ |
||||
|
"CAP": { |
||||
|
"PostgreSql": { |
||||
|
"TableNamePrefix": "pt_event", |
||||
|
"ConnectionString": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer" |
||||
|
} |
||||
|
}, |
||||
|
"Quartz": { |
||||
|
"UsePersistentStore": true, |
||||
|
"Properties": { |
||||
|
"quartz.jobStore.dataSource": "tkm", |
||||
|
"quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX,Quartz", |
||||
|
"quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.PostgreSQLDelegate,Quartz", |
||||
|
"quartz.dataSource.tkm.connectionString": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"quartz.dataSource.tkm.connectionStringName": "TaskManagement", |
||||
|
"quartz.dataSource.tkm.provider": "Npgsql", |
||||
|
"quartz.jobStore.clustered": "true", |
||||
|
"quartz.serializer.type": "json" |
||||
|
} |
||||
|
}, |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpSaas": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpTenantManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpSettingManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpPermissionManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpFeatureManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpTextTemplating": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpLocalizationManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"Workflow": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer" |
||||
|
}, |
||||
|
"Elsa": { |
||||
|
"Features": { |
||||
|
"DefaultPersistence": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"PostgreSql": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"Webhooks": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"PostgreSql": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"WorkflowSettings": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"PostgreSql": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,63 @@ |
|||||
|
{ |
||||
|
"CAP": { |
||||
|
"SqlServer": { |
||||
|
"TableNamePrefix": "pt_event", |
||||
|
"ConnectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false" |
||||
|
} |
||||
|
}, |
||||
|
"Quartz": { |
||||
|
"UsePersistentStore": true, |
||||
|
"Properties": { |
||||
|
"quartz.jobStore.dataSource": "tkm", |
||||
|
"quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX,Quartz", |
||||
|
"quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.SqlServerDelegate,Quartz", |
||||
|
"quartz.dataSource.tkm.connectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"quartz.dataSource.tkm.connectionStringName": "Default", |
||||
|
"quartz.dataSource.tkm.provider": "SqlServer", |
||||
|
"quartz.jobStore.clustered": "true", |
||||
|
"quartz.serializer.type": "json" |
||||
|
} |
||||
|
}, |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"AbpSaas": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"AbpTenantManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false", |
||||
|
"Workflow": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=123456;Encrypt=false" |
||||
|
}, |
||||
|
"Elsa": { |
||||
|
"Features": { |
||||
|
"DefaultPersistence": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"SqlServer": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"Webhooks": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"SqlServer": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"WorkflowSettings": { |
||||
|
"Enabled": true, |
||||
|
"ConnectionStringIdentifier": "Workflow", |
||||
|
"EntityFrameworkCore": { |
||||
|
"SqlServer": { |
||||
|
"Enabled": true |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,23 +0,0 @@ |
|||||
{ |
|
||||
"ConnectionStrings": { |
|
||||
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=P@ssw@rd!;Encrypt=false" |
|
||||
}, |
|
||||
"CAP": { |
|
||||
"SqlServer": { |
|
||||
"TableNamePrefix": "pt_event", |
|
||||
"ConnectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=P@ssw@rd!;Encrypt=false" |
|
||||
} |
|
||||
}, |
|
||||
"Quartz": { |
|
||||
"Properties": { |
|
||||
"quartz.jobStore.dataSource": "tkm", |
|
||||
"quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX,Quartz", |
|
||||
"quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.SqlServerDelegate,Quartz", |
|
||||
"quartz.dataSource.tkm.connectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=P@ssw@rd!;Encrypt=false", |
|
||||
"quartz.dataSource.tkm.provider": "SqlServer", |
|
||||
"quartz.jobStore.clustered": true, |
|
||||
"quartz.checkConfiguration": "false", |
|
||||
"quartz.serializer.type": "json" |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue