Skip to content

Commit

Permalink
Add data compression and format fields to WorkflowInstances
Browse files Browse the repository at this point in the history
This commit introduces two new fields to the WorkflowInstances table: "DataCompressionAlgorithm" and "DataFormat". These changes allow storing additional contextual information about the payloads of workflow instances and enhance future handling and processing of this data.
  • Loading branch information
sfmskywalker committed Feb 3, 2024
1 parent 22f7208 commit 383eeab
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 149 deletions.
5 changes: 0 additions & 5 deletions migrations/efcore-3.1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ for module in "${mods[@]}"; do
echo "Provider path: ${providerPath:?}/${migrationsPath}"
echo "Migrations path: $migrationsPath"
echo "Connection string: ${connStrings[$provider]}"

# 1. Delete the existing migration
echo "Deleting existing migrations: ${providerPath:?}/${migrationsPath}/*V3_1.cs"
find "${providerPath:?}/${migrationsPath}/" -type f -name "*V3_1*" -exec rm -f {} \;
# rm -rf "${providerPath:?}/${migrationsPath}/*V3_1.cs"

# 2. Run the migrations command
dotnet ef migrations add V3_1 -c "$module"ElsaDbContext -p "$providerPath" -o "$migrationsPath" -- --connectionString "${connStrings[$provider]}"
Expand Down
5 changes: 5 additions & 0 deletions src/bundles/Elsa.Server.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Elsa.MongoDb.Modules.Identity;
using Elsa.MongoDb.Modules.Management;
using Elsa.MongoDb.Modules.Runtime;
using Elsa.Workflows.Management.Compression;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Options;
using Proto.Persistence.Sqlite;
Expand All @@ -29,6 +30,7 @@
const bool useMassTransit = false;
const bool useMassTransitAzureServiceBus = true;
const bool useMassTransitRabbitMq = false;
const bool useZipCompression = false;

var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
Expand Down Expand Up @@ -106,6 +108,9 @@
else
ef.UseSqlite(sqliteConnectionString);
});
if(useZipCompression)
management.SetCompressionAlgorithm(nameof(GZip));
})
.UseWorkflowRuntime(runtime =>
{
Expand Down

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management
{
/// <inheritdoc />
public partial class V31 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DataCompressionAlgorithm",
schema: "Elsa",
table: "WorkflowInstances",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AddColumn<string>(
name: "DataFormat",
schema: "Elsa",
table: "WorkflowInstances",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DataCompressionAlgorithm",
schema: "Elsa",
table: "WorkflowInstances");

migrationBuilder.DropColumn(
name: "DataFormat",
schema: "Elsa",
table: "WorkflowInstances");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("Data")
.HasColumnType("longtext");
b.Property<string>("DataCompressionAlgorithm")
.HasColumnType("longtext");
b.Property<string>("DataFormat")
.HasColumnType("longtext");
b.Property<string>("DefinitionId")
.IsRequired()
.HasColumnType("varchar(255)");
Expand Down Expand Up @@ -119,6 +113,12 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("Data")
.HasColumnType("longtext");
b.Property<string>("DataCompressionAlgorithm")
.HasColumnType("longtext");
b.Property<string>("DataFormat")
.HasColumnType("longtext");
b.Property<string>("DefinitionId")
.IsRequired()
.HasColumnType("varchar(255)");
Expand Down

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management
{
/// <inheritdoc />
public partial class V3_1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DataCompressionAlgorithm",
schema: "Elsa",
table: "WorkflowInstances",
type: "text",
nullable: true);

migrationBuilder.AddColumn<string>(
name: "DataFormat",
schema: "Elsa",
table: "WorkflowInstances",
type: "text",
nullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DataCompressionAlgorithm",
schema: "Elsa",
table: "WorkflowInstances");

migrationBuilder.DropColumn(
name: "DataFormat",
schema: "Elsa",
table: "WorkflowInstances");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("Data")
.HasColumnType("text");
b.Property<string>("DataCompressionAlgorithm")
.HasColumnType("text");
b.Property<string>("DataFormat")
.HasColumnType("text");
b.Property<string>("DefinitionId")
.IsRequired()
.HasColumnType("text");
Expand Down Expand Up @@ -122,6 +116,12 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("Data")
.HasColumnType("text");
b.Property<string>("DataCompressionAlgorithm")
.HasColumnType("text");
b.Property<string>("DataFormat")
.HasColumnType("text");
b.Property<string>("DefinitionId")
.IsRequired()
.HasColumnType("text");
Expand Down

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
{
/// <inheritdoc />
public partial class V3_1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DataCompressionAlgorithm",
schema: "Elsa",
table: "WorkflowInstances",
type: "nvarchar(max)",
nullable: true);

migrationBuilder.AddColumn<string>(
name: "DataFormat",
schema: "Elsa",
table: "WorkflowInstances",
type: "nvarchar(max)",
nullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DataCompressionAlgorithm",
schema: "Elsa",
table: "WorkflowInstances");

migrationBuilder.DropColumn(
name: "DataFormat",
schema: "Elsa",
table: "WorkflowInstances");
}
}
}
Loading

0 comments on commit 383eeab

Please sign in to comment.