Include activity version with execution log

This commit is contained in:
Sipke Schoorstra 2023-07-18 11:20:00 +02:00
parent 479bdda002
commit 6ae59f06d6
33 changed files with 177 additions and 23 deletions

View file

@ -12,6 +12,11 @@ public static class ActivityExtensions
/// Gets the type name of the specified activity.
/// </summary>
public static string GetTypeName(this JsonObject activity) => activity.GetProperty<string>("type")!;
/// <summary>
/// Gets the version of the specified activity.
/// </summary>
public static int GetVersion(this JsonObject activity) => activity.GetProperty<int>("version");
/// <summary>
/// Gets the ID of the specified activity.

View file

@ -8,6 +8,7 @@ namespace Elsa.Api.Client.Resources.WorkflowInstances.Models;
/// <param name="ParentActivityInstanceId">The ID of the parent activity instance associated with the execution log record.</param>
/// <param name="ActivityId">The ID of the activity associated with the execution log record.</param>
/// <param name="ActivityType">The type of the activity associated with the execution log record.</param>
/// <param name="ActivityTypeVersion">The version of the activity type associated with the execution log record.</param>
/// <param name="NodeId">The ID of the node associated with the execution log record.</param>
/// <param name="Timestamp">The timestamp of the execution log record.</param>
/// <param name="Sequence">The sequence of the execution log record.</param>
@ -22,6 +23,7 @@ public record ExecutionLogRecord(
string? ParentActivityInstanceId,
string ActivityId,
string ActivityType,
int ActivityTypeVersion,
string NodeId,
DateTimeOffset Timestamp,
long Sequence,

View file

@ -42,6 +42,7 @@ public class Initial : Migration
.WithColumn("ParentActivityInstanceId").AsString().Nullable()
.WithColumn("ActivityId").AsString().NotNullable()
.WithColumn("ActivityType").AsString().NotNullable()
.WithColumn("ActivityTypeVersion").AsInt32().NotNullable()
.WithColumn("NodeId").AsString().NotNullable()
.WithColumn("EventName").AsString().Nullable()
.WithColumn("Message").AsString().Nullable()
@ -61,6 +62,7 @@ public class Initial : Migration
.WithColumn("ParentActivityInstanceId").AsString().Nullable()
.WithColumn("ActivityId").AsString().NotNullable()
.WithColumn("ActivityType").AsString().NotNullable()
.WithColumn("ActivityTypeVersion").AsInt32().NotNullable()
.WithColumn("NodeId").AsString().NotNullable()
.WithColumn("EventName").AsString().Nullable()
.WithColumn("Message").AsString().Nullable()

View file

@ -10,6 +10,7 @@ internal class WorkflowExecutionLogRecordRecord
public string? ParentActivityInstanceId { get; set; }
public string ActivityId { get; set; } = default!;
public string ActivityType { get; set; } = default!;
public int ActivityTypeVersion { get; set; }
public string NodeId { get; set; } = default!;
public DateTimeOffset Timestamp { get; set; }
public string? EventName { get; set; }

View file

@ -103,6 +103,7 @@ public class DapperWorkflowExecutionLogStore : IWorkflowExecutionLogStore
ParentActivityInstanceId = source.ParentActivityInstanceId,
ActivityId = source.ActivityId,
ActivityType = source.ActivityType,
ActivityTypeVersion = source.ActivityTypeVersion,
NodeId = source.NodeId,
Timestamp = source.Timestamp,
EventName = source.EventName,
@ -125,6 +126,7 @@ public class DapperWorkflowExecutionLogStore : IWorkflowExecutionLogStore
ParentActivityInstanceId = source.ParentActivityInstanceId,
ActivityId = source.ActivityId,
ActivityType = source.ActivityType,
ActivityTypeVersion = source.ActivityTypeVersion,
NodeId = source.NodeId,
Timestamp = source.Timestamp,
EventName = source.EventName,

View file

@ -4,8 +4,13 @@ using Microsoft.EntityFrameworkCore.Design;
namespace Elsa.EntityFrameworkCore.MySql.Abstractions;
/// <summary>
/// A base class for implementing a design-time factory for creating a <see cref="DbContext"/> with a MySQL database.
/// </summary>
/// <typeparam name="TDbContext">The type of the <see cref="DbContext"/>.</typeparam>
public abstract class MySqlDesignTimeDbContextFactoryBase<TDbContext> : IDesignTimeDbContextFactory<TDbContext> where TDbContext : DbContext
{
/// <inheritdoc />
public TDbContext CreateDbContext(string[] args)
{
var connectionString = args.Any() ? args[0] : "Data Source=local";

View file

@ -22,9 +22,5 @@
<ItemGroup>
<ProjectReference Include="..\Elsa.EntityFrameworkCore\Elsa.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\Runtime\" />
</ItemGroup>
</Project>

View file

@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
{
[DbContext(typeof(RuntimeElsaDbContext))]
[Migration("20230709103833_Initial")]
[Migration("20230718091027_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -179,6 +179,9 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
.IsRequired()
.HasColumnType("varchar(255)");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("int");
b.Property<string>("EventName")
.HasColumnType("varchar(255)");
@ -226,6 +229,9 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -247,6 +253,9 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
@ -60,6 +61,7 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
.Annotation("MySql:CharSet", "utf8mb4"),
ActivityType = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ActivityTypeVersion = table.Column<int>(type: "int", nullable: false),
NodeId = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Timestamp = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
@ -181,6 +183,18 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
table: "WorkflowExecutionLogRecords",
column: "ActivityType");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion",
schema: "Elsa",
table: "WorkflowExecutionLogRecords",
columns: new[] { "ActivityType", "ActivityTypeVersion" });
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityTypeVersion",
schema: "Elsa",
table: "WorkflowExecutionLogRecords",
column: "ActivityTypeVersion");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_EventName",
schema: "Elsa",

View file

@ -176,6 +176,9 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
.IsRequired()
.HasColumnType("varchar(255)");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("int");
b.Property<string>("EventName")
.HasColumnType("varchar(255)");
@ -223,6 +226,9 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -244,6 +250,9 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -4,8 +4,13 @@ using Microsoft.EntityFrameworkCore.Design;
namespace Elsa.EntityFrameworkCore.PostgreSql.Abstractions;
/// <summary>
/// A base class for implementing a design-time factory for creating a <see cref="DbContext"/> with a PostgreSQL database.
/// </summary>
/// <typeparam name="TDbContext">The type of the <see cref="DbContext"/>.</typeparam>
public abstract class PostgreSqlDesignTimeDbContextFactoryBase<TDbContext> : IDesignTimeDbContextFactory<TDbContext> where TDbContext : DbContext
{
/// <inheritdoc />
public TDbContext CreateDbContext(string[] args)
{
var connectionString = args.Any() ? args[0] : "Data Source=local";

View file

@ -22,9 +22,5 @@
<ItemGroup>
<ProjectReference Include="..\Elsa.EntityFrameworkCore\Elsa.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\Runtime\" />
</ItemGroup>
</Project>

View file

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
{
[DbContext(typeof(RuntimeElsaDbContext))]
[Migration("20230709103914_Initial")]
[Migration("20230718091049_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -182,6 +182,9 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
.IsRequired()
.HasColumnType("text");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("integer");
b.Property<string>("EventName")
.HasColumnType("text");
@ -229,6 +232,9 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -250,6 +256,9 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
@ -43,6 +44,7 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
ParentActivityInstanceId = table.Column<string>(type: "text", nullable: true),
ActivityId = table.Column<string>(type: "text", nullable: false),
ActivityType = table.Column<string>(type: "text", nullable: false),
ActivityTypeVersion = table.Column<int>(type: "integer", nullable: false),
NodeId = table.Column<string>(type: "text", nullable: false),
Timestamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Sequence = table.Column<long>(type: "bigint", nullable: false),
@ -143,6 +145,18 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
table: "WorkflowExecutionLogRecords",
column: "ActivityType");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion",
schema: "Elsa",
table: "WorkflowExecutionLogRecords",
columns: new[] { "ActivityType", "ActivityTypeVersion" });
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityTypeVersion",
schema: "Elsa",
table: "WorkflowExecutionLogRecords",
column: "ActivityTypeVersion");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_EventName",
schema: "Elsa",

View file

@ -179,6 +179,9 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
.IsRequired()
.HasColumnType("text");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("integer");
b.Property<string>("EventName")
.HasColumnType("text");
@ -226,6 +229,9 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -247,6 +253,9 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -4,8 +4,13 @@ using Microsoft.EntityFrameworkCore.Design;
namespace Elsa.EntityFrameworkCore.SqlServer.Abstractions;
/// <summary>
/// A base class for implementing a design-time factory for creating a <see cref="DbContext"/> with a SQL Server database.
/// </summary>
/// <typeparam name="TDbContext">The type of the <see cref="DbContext"/>.</typeparam>
public abstract class SqlServerDesignTimeDbContextFactoryBase<TDbContext> : IDesignTimeDbContextFactory<TDbContext> where TDbContext : DbContext
{
/// <inheritdoc />
public TDbContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<TDbContext>();

View file

@ -23,8 +23,4 @@
<ProjectReference Include="..\Elsa.EntityFrameworkCore\Elsa.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\Runtime\" />
</ItemGroup>
</Project>

View file

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
{
[DbContext(typeof(RuntimeElsaDbContext))]
[Migration("20230709103937_Initial")]
[Migration("20230718091114_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -182,6 +182,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("int");
b.Property<string>("EventName")
.HasColumnType("nvarchar(450)");
@ -229,6 +232,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -250,6 +256,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
@ -43,6 +44,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
ParentActivityInstanceId = table.Column<string>(type: "nvarchar(450)", nullable: true),
ActivityId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ActivityType = table.Column<string>(type: "nvarchar(450)", nullable: false),
ActivityTypeVersion = table.Column<int>(type: "int", nullable: false),
NodeId = table.Column<string>(type: "nvarchar(max)", nullable: false),
Timestamp = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
Sequence = table.Column<long>(type: "bigint", nullable: false),
@ -143,6 +145,18 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
table: "WorkflowExecutionLogRecords",
column: "ActivityType");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion",
schema: "Elsa",
table: "WorkflowExecutionLogRecords",
columns: new[] { "ActivityType", "ActivityTypeVersion" });
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityTypeVersion",
schema: "Elsa",
table: "WorkflowExecutionLogRecords",
column: "ActivityTypeVersion");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_EventName",
schema: "Elsa",

View file

@ -179,6 +179,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("int");
b.Property<string>("EventName")
.HasColumnType("nvarchar(450)");
@ -226,6 +229,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -247,6 +253,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -4,8 +4,13 @@ using Microsoft.EntityFrameworkCore.Design;
namespace Elsa.EntityFrameworkCore.Sqlite.Abstractions;
/// <summary>
/// A base class for implementing a design-time factory for creating a <see cref="DbContext"/> with a SQLite database.
/// </summary>
/// <typeparam name="TDbContext">The type of the <see cref="DbContext"/>.</typeparam>
public abstract class SqliteDesignTimeDbContextFactoryBase<TDbContext> : IDesignTimeDbContextFactory<TDbContext> where TDbContext : DbContext
{
/// <inheritdoc />
public TDbContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<TDbContext>();

View file

@ -24,8 +24,4 @@
<ProjectReference Include="..\Elsa.EntityFrameworkCore\Elsa.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\Runtime\" />
</ItemGroup>
</Project>

View file

@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
{
[DbContext(typeof(RuntimeElsaDbContext))]
[Migration("20230709101618_Initial")]
[Migration("20230718091102_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -177,6 +177,9 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("INTEGER");
b.Property<string>("EventName")
.HasColumnType("TEXT");
@ -225,6 +228,9 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -246,6 +252,9 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -38,6 +38,7 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
ParentActivityInstanceId = table.Column<string>(type: "TEXT", nullable: true),
ActivityId = table.Column<string>(type: "TEXT", nullable: false),
ActivityType = table.Column<string>(type: "TEXT", nullable: false),
ActivityTypeVersion = table.Column<int>(type: "INTEGER", nullable: false),
NodeId = table.Column<string>(type: "TEXT", nullable: false),
Timestamp = table.Column<string>(type: "TEXT", nullable: false),
Sequence = table.Column<long>(type: "INTEGER", nullable: false),
@ -128,6 +129,16 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
table: "WorkflowExecutionLogRecords",
column: "ActivityType");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion",
table: "WorkflowExecutionLogRecords",
columns: new[] { "ActivityType", "ActivityTypeVersion" });
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_ActivityTypeVersion",
table: "WorkflowExecutionLogRecords",
column: "ActivityTypeVersion");
migrationBuilder.CreateIndex(
name: "IX_WorkflowExecutionLogRecord_EventName",
table: "WorkflowExecutionLogRecords",

View file

@ -174,6 +174,9 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ActivityTypeVersion")
.HasColumnType("INTEGER");
b.Property<string>("EventName")
.HasColumnType("TEXT");
@ -222,6 +225,9 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
b.HasIndex("ActivityType")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType");
b.HasIndex("ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion");
b.HasIndex("EventName")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName");
@ -243,6 +249,9 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime
b.HasIndex("WorkflowVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowVersion");
b.HasIndex("ActivityType", "ActivityTypeVersion")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion");
b.HasIndex("Timestamp", "Sequence")
.HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp_Sequence");

View file

@ -63,6 +63,8 @@ public class Configurations :
builder.HasIndex(x => x.ParentActivityInstanceId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.ParentActivityInstanceId)}");
builder.HasIndex(x => x.ActivityId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.ActivityId)}");
builder.HasIndex(x => x.ActivityType).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.ActivityType)}");
builder.HasIndex(x => x.ActivityTypeVersion).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.ActivityTypeVersion)}");
builder.HasIndex(x => new {x.ActivityType, x.ActivityTypeVersion}).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.ActivityType)}_{nameof(WorkflowExecutionLogRecord.ActivityTypeVersion)}");
builder.HasIndex(x => x.EventName).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.EventName)}");
builder.HasIndex(x => x.WorkflowDefinitionId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.WorkflowDefinitionId)}");
builder.HasIndex(x => x.WorkflowInstanceId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.WorkflowInstanceId)}");

View file

@ -79,6 +79,7 @@ internal class CreateIndices : IHostedService
new(indexBuilder.Ascending(x => x.ParentActivityInstanceId)),
new(indexBuilder.Ascending(x => x.ActivityId)),
new(indexBuilder.Ascending(x => x.ActivityType)),
new(indexBuilder.Ascending(x => x.ActivityTypeVersion)),
new(indexBuilder.Ascending(x => x.EventName)),
new(indexBuilder.Ascending(x => x.WorkflowInstanceId)),
new(indexBuilder.Ascending(x => x.WorkflowVersion))

View file

@ -42,6 +42,7 @@ internal class Get : ElsaEndpoint<Request, Response>
x.ParentActivityInstanceId,
x.ActivityId,
x.ActivityType,
x.ActivityTypeVersion,
x.NodeId,
x.Timestamp,
x.Sequence,

View file

@ -53,6 +53,7 @@ internal record ExecutionLogRecord(
string? ParentActivityInstanceId,
string ActivityId,
string ActivityType,
int ActivityTypeVersion,
string NodeId,
DateTimeOffset Timestamp,
long Sequence,

View file

@ -98,6 +98,7 @@ public static class ActivityExecutionContextExtensions
parentActivityInstanceId,
activity.Id,
activity.Type,
activity.Version,
context.NodeId,
activityState,
now,

View file

@ -8,6 +8,7 @@ public record WorkflowExecutionLogEntry(
string? ParentActivityInstanceId,
string ActivityId,
string ActivityType,
int ActivityTypeVersion,
string NodeId,
IDictionary<string, object>? ActivityState,
DateTimeOffset Timestamp,

View file

@ -42,6 +42,11 @@ public class WorkflowExecutionLogRecord : Entity
/// </summary>
public string ActivityType { get; set; } = default!;
/// <summary>
/// The version of the activity type.
/// </summary>
public int ActivityTypeVersion { get; set; }
/// <summary>
/// The unique ID of the node within the workflow graph.
/// </summary>

View file

@ -39,6 +39,7 @@ public class PersistWorkflowExecutionLogMiddleware : WorkflowExecutionMiddleware
NodeId = x.NodeId,
ActivityId = x.ActivityId,
ActivityType = x.ActivityType,
ActivityTypeVersion = x.ActivityTypeVersion,
Message = x.Message,
EventName = x.EventName,
WorkflowDefinitionId = context.Workflow.Identity.DefinitionId,