parent
f5cc342f58
commit
ccda7691db
|
|
@ -12,7 +12,6 @@ namespace Elsa.Persistence.EntityFramework.MySql
|
|||
public static DbContextOptionsBuilder UseMySql(this DbContextOptionsBuilder builder, string connectionString) =>
|
||||
builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), db => db
|
||||
.MigrationsAssembly(typeof(MySqlElsaContextFactory).Assembly.GetName().Name)
|
||||
.MigrationsHistoryTable(ElsaContext.MigrationsHistoryTable, ElsaContext.ElsaSchema)
|
||||
.SchemaBehavior(MySqlSchemaBehavior.Ignore));
|
||||
.MigrationsHistoryTable(ElsaContext.MigrationsHistoryTable));
|
||||
}
|
||||
}
|
||||
|
|
@ -7,15 +7,11 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "Elsa");
|
||||
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Bookmarks",
|
||||
schema: "Elsa",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
|
|
@ -45,7 +41,6 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkflowDefinitions",
|
||||
schema: "Elsa",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
|
|
@ -79,7 +74,6 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkflowExecutionLogRecords",
|
||||
schema: "Elsa",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
|
|
@ -110,7 +104,6 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkflowInstances",
|
||||
schema: "Elsa",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
|
|
@ -145,200 +138,167 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_ActivityId",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
column: "ActivityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_ActivityType",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
column: "ActivityType");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_ActivityType_TenantId_Hash",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
columns: new[] { "ActivityType", "TenantId", "Hash" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_CorrelationId",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
column: "CorrelationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_Hash",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
column: "Hash");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_Hash_CorrelationId_TenantId",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
columns: new[] { "Hash", "CorrelationId", "TenantId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_TenantId",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bookmark_WorkflowInstanceId",
|
||||
schema: "Elsa",
|
||||
table: "Bookmarks",
|
||||
column: "WorkflowInstanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowDefinition_DefinitionId_VersionId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
columns: new[] { "DefinitionId", "Version" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowDefinition_IsLatest",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
column: "IsLatest");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowDefinition_IsPublished",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
column: "IsPublished");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowDefinition_Name",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
column: "Name");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowDefinition_Tag",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
column: "Tag");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowDefinition_TenantId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowDefinition_Version",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
column: "Version");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowExecutionLogRecord_ActivityId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowExecutionLogRecords",
|
||||
column: "ActivityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowExecutionLogRecord_ActivityType",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowExecutionLogRecords",
|
||||
column: "ActivityType");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowExecutionLogRecord_TenantId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowExecutionLogRecords",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowExecutionLogRecord_Timestamp",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowExecutionLogRecords",
|
||||
column: "Timestamp");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowExecutionLogRecord_WorkflowInstanceId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowExecutionLogRecords",
|
||||
column: "WorkflowInstanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_ContextId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "ContextId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_ContextType",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "ContextType");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_CorrelationId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "CorrelationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_CreatedAt",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "CreatedAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_DefinitionId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "DefinitionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_FaultedAt",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "FaultedAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_FinishedAt",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "FinishedAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_LastExecutedAt",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "LastExecutedAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_Name",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "Name");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_TenantId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_WorkflowStatus",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
column: "WorkflowStatus");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_WorkflowStatus_DefinitionId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
columns: new[] { "WorkflowStatus", "DefinitionId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkflowInstance_WorkflowStatus_DefinitionId_Version",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
columns: new[] { "WorkflowStatus", "DefinitionId", "Version" });
|
||||
}
|
||||
|
|
@ -346,20 +306,16 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Bookmarks",
|
||||
schema: "Elsa");
|
||||
name: "Bookmarks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkflowDefinitions",
|
||||
schema: "Elsa");
|
||||
name: "WorkflowDefinitions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkflowExecutionLogRecords",
|
||||
schema: "Elsa");
|
||||
name: "WorkflowExecutionLogRecords");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkflowInstances",
|
||||
schema: "Elsa");
|
||||
name: "WorkflowInstances");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CorrelationId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
type: "varchar(255)",
|
||||
nullable: false,
|
||||
|
|
@ -21,7 +20,6 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LastExecutedActivityId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
|
|
@ -29,7 +27,6 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OutputStorageProviderName",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
|
|
@ -40,17 +37,14 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LastExecutedActivityId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OutputStorageProviderName",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowDefinitions");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CorrelationId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
type: "varchar(255)",
|
||||
nullable: true,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ namespace Elsa.Persistence.EntityFramework.MySql.Migrations
|
|||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Elsa")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.6");
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Linq;
|
|||
using Elsa.Persistence.EntityFramework.Core;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
|
||||
|
||||
namespace Elsa.Persistence.EntityFramework.MySql
|
||||
{
|
||||
|
|
@ -19,7 +20,8 @@ namespace Elsa.Persistence.EntityFramework.MySql
|
|||
serverVersion != null ? ServerVersion.Parse(serverVersion) : ServerVersion.AutoDetect(connectionString),
|
||||
db => db
|
||||
.MigrationsAssembly(typeof(MySqlElsaContextFactory).Assembly.GetName().Name)
|
||||
.MigrationsHistoryTable(ElsaContext.MigrationsHistoryTable, ElsaContext.ElsaSchema));
|
||||
.MigrationsHistoryTable(ElsaContext.MigrationsHistoryTable)
|
||||
.SchemaBehavior(MySqlSchemaBehavior.Ignore));
|
||||
|
||||
return new ElsaContext(builder.Options);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue