diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241026094453_V3_3.Designer.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241023123010_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241026094453_V3_3.Designer.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241023123010_V3_3.Designer.cs index 0fc0aab255..285452d06c 100644 --- a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241026094453_V3_3.Designer.cs +++ b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241023123010_V3_3.Designer.cs @@ -10,7 +10,7 @@ namespace Elsa.Agents.Persistence.EntityFrameworkCore.MySql.Migrations { [DbContext(typeof(AgentsDbContext))] - [Migration("20241026094453_V3_3")] + [Migration("20241023123010_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241026094453_V3_3.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241023123010_V3_3.cs similarity index 100% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241026094453_V3_3.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.MySql/Migrations/20241023123010_V3_3.cs diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241026094528_V3_3.Designer.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241023122148_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241026094528_V3_3.Designer.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241023122148_V3_3.Designer.cs index 1779b2944e..e6c43e0a0e 100644 --- a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241026094528_V3_3.Designer.cs +++ b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241023122148_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql.Migrations { [DbContext(typeof(AgentsDbContext))] - [Migration("20241026094528_V3_3")] + [Migration("20241023122148_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241026094528_V3_3.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241023122148_V3_3.cs similarity index 100% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241026094528_V3_3.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql/Migrations/20241023122148_V3_3.cs diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241026094613_V3_3.Designer.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241023123153_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241026094613_V3_3.Designer.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241023123153_V3_3.Designer.cs index 91693675ec..c571b21aaa 100644 --- a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241026094613_V3_3.Designer.cs +++ b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241023123153_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer.Migrations { [DbContext(typeof(AgentsDbContext))] - [Migration("20241026094613_V3_3")] + [Migration("20241023123153_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241026094613_V3_3.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241023123153_V3_3.cs similarity index 100% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241026094613_V3_3.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer/Migrations/20241023123153_V3_3.cs diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241026094553_V3_3.Designer.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241023123129_V3_3.Designer.cs similarity index 98% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241026094553_V3_3.Designer.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241023123129_V3_3.Designer.cs index 606aacc858..5a4e3bc347 100644 --- a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241026094553_V3_3.Designer.cs +++ b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241023123129_V3_3.Designer.cs @@ -10,7 +10,7 @@ namespace Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite.Migrations { [DbContext(typeof(AgentsDbContext))] - [Migration("20241026094553_V3_3")] + [Migration("20241023123129_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241026094553_V3_3.cs b/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241023123129_V3_3.cs similarity index 100% rename from src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241026094553_V3_3.cs rename to src/modules/Elsa.Agents.Persistence.EntityFrameworkCore.Sqlite/Migrations/20241023123129_V3_3.cs diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20231015122151_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20231015122151_Initial.Designer.cs new file mode 100644 index 0000000000..9dcb708d85 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20231015122151_Initial.Designer.cs @@ -0,0 +1,119 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20231015122151_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedLog") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("SerializedAlterations") + .HasColumnType("longtext"); + + b.Property("SerializedWorkflowInstanceIds") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20241026094641_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20231015122151_Initial.cs similarity index 78% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20241026094641_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20231015122151_Initial.cs index 2d02d01a20..09c731fb33 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20241026094641_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20231015122151_Initial.cs @@ -1,26 +1,22 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); @@ -36,14 +32,11 @@ protected override void Up(MigrationBuilder migrationBuilder) .Annotation("MySql:CharSet", "utf8mb4"), WorkflowInstanceId = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), - Status = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), + Status = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), StartedAt = table.Column(type: "datetime(6)", nullable: true), CompletedAt = table.Column(type: "datetime(6)", nullable: true), SerializedLog = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -59,16 +52,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), - Status = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), + Status = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), StartedAt = table.Column(type: "datetime(6)", nullable: true), CompletedAt = table.Column(type: "datetime(6)", nullable: true), SerializedAlterations = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), - SerializedWorkflowInstanceFilter = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) + SerializedWorkflowInstanceIds = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -107,12 +97,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "AlterationJobs", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_AlterationJob_TenantId", - schema: _schema.Schema, - table: "AlterationJobs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_AlterationJob_WorkflowInstanceId", schema: _schema.Schema, @@ -142,12 +126,6 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: _schema.Schema, table: "AlterationPlans", column: "Status"); - - migrationBuilder.CreateIndex( - name: "IX_AlterationPlan_TenantId", - schema: _schema.Schema, - table: "AlterationPlans", - column: "TenantId"); } /// diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240329200618_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240329200618_V3_1.Designer.cs new file mode 100644 index 0000000000..df3478e064 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240329200618_V3_1.Designer.cs @@ -0,0 +1,121 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240329200618_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedLog") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("SerializedAlterations") + .HasColumnType("longtext"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240329200618_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240329200618_V3_1.cs new file mode 100644 index 0000000000..56b1865c06 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240329200618_V3_1.cs @@ -0,0 +1,78 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceIds", + schema: _schema.Schema, + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceFilter"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationPlans", + type: "varchar(255)", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationJobs", + type: "varchar(255)", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceFilter", + schema: _schema.Schema, + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceIds"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationPlans", + type: "int", + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(255)") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationJobs", + type: "int", + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(255)") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240610184517_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240610184517_V3_2.Designer.cs new file mode 100644 index 0000000000..ed6e592156 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240610184517_V3_2.Designer.cs @@ -0,0 +1,121 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240610184517_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedLog") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("SerializedAlterations") + .HasColumnType("longtext"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240610184517_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240610184517_V3_2.cs new file mode 100644 index 0000000000..ca400108fe --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240610184517_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20241026094641_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240715192955_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20241026094641_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240715192955_V3_3.Designer.cs index 0b5f2aa6be..067a5bd08d 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20241026094641_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240715192955_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations { [DbContext(typeof(AlterationsElsaDbContext))] - [Migration("20241026094641_V3_3")] + [Migration("20240715192955_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240715192955_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240715192955_V3_3.cs new file mode 100644 index 0000000000..a2539bdb45 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Alterations/20240715192955_V3_3.cs @@ -0,0 +1,74 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Alterations +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationPlans", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationJobs", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_AlterationPlan_TenantId", + schema: _schema.Schema, + table: "AlterationPlans", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AlterationJob_TenantId", + schema: _schema.Schema, + table: "AlterationJobs", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_AlterationPlan_TenantId", + schema: _schema.Schema, + table: "AlterationPlans"); + + migrationBuilder.DropIndex( + name: "IX_AlterationJob_TenantId", + schema: _schema.Schema, + table: "AlterationJobs"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationPlans"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationJobs"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20231015122238_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20231015122238_Initial.Designer.cs new file mode 100644 index 0000000000..aa2f7e6300 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20231015122238_Initial.Designer.cs @@ -0,0 +1,128 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20231015122238_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20241026094829_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20231015122238_Initial.cs similarity index 79% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20241026094829_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20231015122238_Initial.cs index 2af5be9903..69da23b236 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20241026094829_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20231015122238_Initial.cs @@ -1,25 +1,22 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); @@ -44,8 +41,6 @@ protected override void Up(MigrationBuilder migrationBuilder) HashedApiKeySalt = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Roles = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -64,8 +59,6 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Permissions = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -88,8 +81,6 @@ protected override void Up(MigrationBuilder migrationBuilder) HashedPasswordSalt = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Roles = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -112,12 +103,6 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Application_TenantId", - schema: _schema.Schema, - table: "Applications", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_Role_Name", schema: _schema.Schema, @@ -125,24 +110,12 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Role_TenantId", - schema: _schema.Schema, - table: "Roles", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_User_Name", schema: _schema.Schema, table: "Users", column: "Name", unique: true); - - migrationBuilder.CreateIndex( - name: "IX_User_TenantId", - schema: _schema.Schema, - table: "Users", - column: "TenantId"); } /// diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240329200746_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240329200746_V3_1.Designer.cs new file mode 100644 index 0000000000..faaf237893 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240329200746_V3_1.Designer.cs @@ -0,0 +1,128 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240329200746_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240329200746_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240329200746_V3_1.cs new file mode 100644 index 0000000000..36999aa945 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240329200746_V3_1.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240610184903_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240610184903_V3_2.Designer.cs new file mode 100644 index 0000000000..e25e181018 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240610184903_V3_2.Designer.cs @@ -0,0 +1,128 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240610184903_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240610184903_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240610184903_V3_2.cs new file mode 100644 index 0000000000..d514c417fb --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240610184903_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20241026094829_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240715193513_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20241026094829_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240715193513_V3_3.Designer.cs index 270d5ec66f..0cad7b4fc0 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20241026094829_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240715193513_V3_3.Designer.cs @@ -10,7 +10,7 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity { [DbContext(typeof(IdentityElsaDbContext))] - [Migration("20241026094829_V3_3")] + [Migration("20240715193513_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240715193513_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240715193513_V3_3.cs new file mode 100644 index 0000000000..a81f899216 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Identity/20240715193513_V3_3.cs @@ -0,0 +1,98 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Identity +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Users", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Roles", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Applications", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_User_TenantId", + schema: _schema.Schema, + table: "Users", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Role_TenantId", + schema: _schema.Schema, + table: "Roles", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Application_TenantId", + schema: _schema.Schema, + table: "Applications", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_User_TenantId", + schema: _schema.Schema, + table: "Users"); + + migrationBuilder.DropIndex( + name: "IX_Role_TenantId", + schema: _schema.Schema, + table: "Roles"); + + migrationBuilder.DropIndex( + name: "IX_Application_TenantId", + schema: _schema.Schema, + table: "Applications"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Users"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Roles"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Applications"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20231015122253_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20231015122253_Initial.Designer.cs new file mode 100644 index 0000000000..a644c444cd --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20231015122253_Initial.Designer.cs @@ -0,0 +1,82 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20231015122253_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("Color") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20241026094901_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20231015122253_Initial.cs similarity index 81% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20241026094901_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20231015122253_Initial.cs index c61d3e0f10..16cb06abfb 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20241026094901_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20231015122253_Initial.cs @@ -1,25 +1,22 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); @@ -38,8 +35,6 @@ protected override void Up(MigrationBuilder migrationBuilder) Description = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Color = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -60,8 +55,6 @@ protected override void Up(MigrationBuilder migrationBuilder) WorkflowDefinitionVersionId = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), LabelId = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -76,12 +69,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitionLabels", column: "LabelId"); - migrationBuilder.CreateIndex( - name: "WorkflowDefinitionLabel_TenantId", - schema: _schema.Schema, - table: "WorkflowDefinitionLabels", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "WorkflowDefinitionLabel_WorkflowDefinitionId", schema: _schema.Schema, diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240329200817_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240329200817_V3_1.Designer.cs new file mode 100644 index 0000000000..d1b0b49cee --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240329200817_V3_1.Designer.cs @@ -0,0 +1,82 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240329200817_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("Color") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240329200817_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240329200817_V3_1.cs new file mode 100644 index 0000000000..c6ee183fe5 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240329200817_V3_1.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240610184957_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240610184957_V3_2.Designer.cs new file mode 100644 index 0000000000..cdd9a69484 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240610184957_V3_2.Designer.cs @@ -0,0 +1,82 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240610184957_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("Color") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240610184957_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240610184957_V3_2.cs new file mode 100644 index 0000000000..290adf17a3 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240610184957_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20241026094901_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240715193630_V3_3.Designer.cs similarity index 98% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20241026094901_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240715193630_V3_3.Designer.cs index 27a7733d48..b4897f3888 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20241026094901_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240715193630_V3_3.Designer.cs @@ -10,7 +10,7 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels { [DbContext(typeof(LabelsElsaDbContext))] - [Migration("20241026094901_V3_3")] + [Migration("20240715193630_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240715193630_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240715193630_V3_3.cs new file mode 100644 index 0000000000..9398228db1 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Labels/20240715193630_V3_3.cs @@ -0,0 +1,63 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Labels +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Labels", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "WorkflowDefinitionLabel_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "WorkflowDefinitionLabel_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Labels"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20231015122223_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20231015122223_Initial.Designer.cs new file mode 100644 index 0000000000..298abc2f61 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20231015122223_Initial.Designer.cs @@ -0,0 +1,193 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20231015122223_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("BinaryData") + .HasColumnType("longblob"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsLatest") + .HasColumnType("tinyint(1)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("IsReadonly") + .HasColumnType("tinyint(1)"); + + b.Property("MaterializerContext") + .HasColumnType("longtext"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("ProviderName") + .HasColumnType("longtext"); + + b.Property("StringData") + .HasColumnType("longtext"); + + b.Property("ToolVersion") + .HasColumnType("longtext"); + + b.Property("UsableAsActivity") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("varchar(255)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FinishedAt") + .HasColumnType("datetime(6)"); + + b.Property("IncidentCount") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20241026094749_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20231015122223_Initial.cs similarity index 82% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20241026094749_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20231015122223_Initial.cs index 5d5c007edf..7c52ef258c 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20241026094749_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20231015122223_Initial.cs @@ -1,26 +1,22 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); @@ -50,12 +46,9 @@ protected override void Up(MigrationBuilder migrationBuilder) .Annotation("MySql:CharSet", "utf8mb4"), BinaryData = table.Column(type: "longblob", nullable: true), IsReadonly = table.Column(type: "tinyint(1)", nullable: false), - IsSystem = table.Column(type: "tinyint(1)", nullable: false), Data = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), UsableAsActivity = table.Column(type: "tinyint(1)", nullable: true), - TenantId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false), Version = table.Column(type: "int", nullable: false), IsLatest = table.Column(type: "tinyint(1)", nullable: false), @@ -79,8 +72,6 @@ protected override void Up(MigrationBuilder migrationBuilder) DefinitionVersionId = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Version = table.Column(type: "int", nullable: false), - ParentWorkflowInstanceId = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), Status = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), SubStatus = table.Column(type: "varchar(255)", nullable: false) @@ -90,15 +81,10 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), IncidentCount = table.Column(type: "int", nullable: false), - IsSystem = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false), FinishedAt = table.Column(type: "datetime(6)", nullable: true), Data = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - DataCompressionAlgorithm = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -126,24 +112,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitions", column: "IsPublished"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_IsSystem", - schema: _schema.Schema, - table: "WorkflowDefinitions", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_Name", schema: _schema.Schema, table: "WorkflowDefinitions", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_TenantId", - schema: _schema.Schema, - table: "WorkflowDefinitions", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_UsableAsActivity", schema: _schema.Schema, @@ -180,12 +154,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowInstances", column: "FinishedAt"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_IsSystem", - schema: _schema.Schema, - table: "WorkflowInstances", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Name", schema: _schema.Schema, @@ -228,12 +196,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowInstances", columns: new[] { "SubStatus", "DefinitionId" }); - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_TenantId", - schema: _schema.Schema, - table: "WorkflowInstances", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_UpdatedAt", schema: _schema.Schema, diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240329200720_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240329200720_V3_1.Designer.cs new file mode 100644 index 0000000000..0828c2c2fb --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240329200720_V3_1.Designer.cs @@ -0,0 +1,211 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240329200720_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("BinaryData") + .HasColumnType("longblob"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsLatest") + .HasColumnType("tinyint(1)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("IsReadonly") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("MaterializerContext") + .HasColumnType("longtext"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("ProviderName") + .HasColumnType("longtext"); + + b.Property("StringData") + .HasColumnType("longtext"); + + b.Property("ToolVersion") + .HasColumnType("longtext"); + + b.Property("UsableAsActivity") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("varchar(255)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("longtext"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FinishedAt") + .HasColumnType("datetime(6)"); + + b.Property("IncidentCount") + .HasColumnType("int"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("longtext"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240329200720_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240329200720_V3_1.cs new file mode 100644 index 0000000000..e4fa114e6d --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240329200720_V3_1.cs @@ -0,0 +1,100 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DataCompressionAlgorithm", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ParentWorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances", + column: "IsSystem"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions", + column: "IsSystem"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "DataCompressionAlgorithm", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "ParentWorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240610184802_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240610184802_V3_2.Designer.cs new file mode 100644 index 0000000000..164db5fe22 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240610184802_V3_2.Designer.cs @@ -0,0 +1,211 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240610184802_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("BinaryData") + .HasColumnType("longblob"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsLatest") + .HasColumnType("tinyint(1)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("IsReadonly") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("MaterializerContext") + .HasColumnType("longtext"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("ProviderName") + .HasColumnType("longtext"); + + b.Property("StringData") + .HasColumnType("longtext"); + + b.Property("ToolVersion") + .HasColumnType("longtext"); + + b.Property("UsableAsActivity") + .HasColumnType("tinyint(1)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("varchar(255)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("longtext"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FinishedAt") + .HasColumnType("datetime(6)"); + + b.Property("IncidentCount") + .HasColumnType("int"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("longtext"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240610184802_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240610184802_V3_2.cs new file mode 100644 index 0000000000..523fc6f4ab --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240610184802_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20241026094749_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240715193349_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20241026094749_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240715193349_V3_3.Designer.cs index e34c4719e1..24eaaab05c 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20241026094749_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240715193349_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management { [DbContext(typeof(ManagementElsaDbContext))] - [Migration("20241026094749_V3_3")] + [Migration("20240715193349_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240715193349_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240715193349_V3_3.cs new file mode 100644 index 0000000000..96b6357cbb --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Management/20240715193349_V3_3.cs @@ -0,0 +1,74 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Management +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_TenantId", + schema: _schema.Schema, + table: "WorkflowInstances", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_TenantId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20231024160940_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20231024160940_Initial.Designer.cs new file mode 100644 index 0000000000..3760de166f --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20231024160940_Initial.Designer.cs @@ -0,0 +1,385 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20231024160940_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityName") + .HasColumnType("varchar(255)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("HasBookmarks") + .HasColumnType("tinyint(1)"); + + b.Property("SerializedActivityState") + .HasColumnType("longtext"); + + b.Property("SerializedException") + .HasColumnType("longtext"); + + b.Property("SerializedOutputs") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedMetadata") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Hash") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityName") + .HasColumnType("varchar(255)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("EventName") + .HasColumnType("varchar(255)"); + + b.Property("Message") + .HasColumnType("longtext"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("Source") + .HasColumnType("longtext"); + + b.Property("Timestamp") + .HasColumnType("datetime(6)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowVersion") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("varchar(255)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("longtext"); + + b.Property("SerializedInput") + .HasColumnType("longtext"); + + b.Property("WorkflowInstanceId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20241026094715_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20231024160940_Initial.cs similarity index 80% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20241026094715_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20231024160940_Initial.cs index eb4ef99334..41b67f76aa 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20241026094715_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20231024160940_Initial.cs @@ -1,26 +1,22 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); @@ -50,17 +46,11 @@ protected override void Up(MigrationBuilder migrationBuilder) CompletedAt = table.Column(type: "datetime(6)", nullable: true), SerializedActivityState = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), - SerializedActivityStateCompressionAlgorithm = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), SerializedException = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SerializedOutputs = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SerializedPayload = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - SerializedProperties = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -69,43 +59,12 @@ protected override void Up(MigrationBuilder migrationBuilder) }) .Annotation("MySql:CharSet", "utf8mb4"); - migrationBuilder.CreateTable( - name: "BookmarkQueueItems", - schema: _schema.Schema, - columns: table => new - { - Id = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - WorkflowInstanceId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - CorrelationId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - BookmarkId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - StimulusHash = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - ActivityInstanceId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - ActivityTypeName = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - CreatedAt = table.Column(type: "datetime(6)", nullable: false), - SerializedOptions = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - migrationBuilder.CreateTable( name: "Bookmarks", schema: _schema.Schema, columns: table => new { - Id = table.Column(type: "varchar(255)", nullable: false) + BookmarkId = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ActivityTypeName = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), @@ -121,31 +80,11 @@ protected override void Up(MigrationBuilder migrationBuilder) SerializedMetadata = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SerializedPayload = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_Bookmarks", x => x.Id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "KeyValuePairs", - schema: _schema.Schema, - columns: table => new - { - Id = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SerializedValue = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { - table.PrimaryKey("PK_KeyValuePairs", x => x.Id); + table.PrimaryKey("PK_Bookmarks", x => x.BookmarkId); }) .Annotation("MySql:CharSet", "utf8mb4"); @@ -167,8 +106,6 @@ protected override void Up(MigrationBuilder migrationBuilder) Hash = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SerializedPayload = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -215,8 +152,6 @@ protected override void Up(MigrationBuilder migrationBuilder) SerializedActivityState = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SerializedPayload = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - TenantId = table.Column(type: "varchar(255)", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -225,6 +160,36 @@ protected override void Up(MigrationBuilder migrationBuilder) }) .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ActivityTypeName = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Hash = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + WorkflowInstanceId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CorrelationId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ActivityInstanceId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ExpiresAt = table.Column(type: "datetime(6)", nullable: false), + SerializedBookmarkPayload = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SerializedInput = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_ActivityId", schema: _schema.Schema, @@ -285,66 +250,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "ActivityExecutionRecords", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_ActivityExecutionRecord_TenantId", - schema: _schema.Schema, - table: "ActivityExecutionRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_WorkflowInstanceId", schema: _schema.Schema, table: "ActivityExecutionRecords", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityInstanceId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "ActivityInstanceId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityTypeName", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "ActivityTypeName"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_BookmarkId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "BookmarkId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CorrelationId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "CorrelationId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CreatedAt", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_StimulusHash", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "StimulusHash"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_TenantId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_WorkflowInstanceId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_ActivityInstanceId", schema: _schema.Schema, @@ -381,24 +292,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Bookmarks", column: "Hash"); - migrationBuilder.CreateIndex( - name: "IX_StoredBookmark_TenantId", - schema: _schema.Schema, - table: "Bookmarks", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_WorkflowInstanceId", schema: _schema.Schema, table: "Bookmarks", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_SerializedKeyValuePair_TenantId", - schema: _schema.Schema, - table: "KeyValuePairs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_Hash", schema: _schema.Schema, @@ -411,12 +310,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Triggers", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_StoredTrigger_TenantId", - schema: _schema.Schema, - table: "Triggers", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_WorkflowDefinitionId", schema: _schema.Schema, @@ -489,12 +382,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowExecutionLogRecords", column: "Sequence"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowExecutionLogRecord_TenantId", - schema: _schema.Schema, - table: "WorkflowExecutionLogRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_Timestamp", schema: _schema.Schema, @@ -530,6 +417,48 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: _schema.Schema, table: "WorkflowExecutionLogRecords", column: "WorkflowVersion"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); } /// @@ -539,24 +468,20 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "ActivityExecutionRecords", schema: _schema.Schema); - migrationBuilder.DropTable( - name: "BookmarkQueueItems", - schema: _schema.Schema); - migrationBuilder.DropTable( name: "Bookmarks", schema: _schema.Schema); migrationBuilder.DropTable( - name: "KeyValuePairs", + name: "Triggers", schema: _schema.Schema); migrationBuilder.DropTable( - name: "Triggers", + name: "WorkflowExecutionLogRecords", schema: _schema.Schema); migrationBuilder.DropTable( - name: "WorkflowExecutionLogRecords", + name: "WorkflowInboxMessages", schema: _schema.Schema); } } diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240329200651_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240329200651_V3_1.Designer.cs new file mode 100644 index 0000000000..128d958ffc --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240329200651_V3_1.Designer.cs @@ -0,0 +1,405 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240329200651_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("varchar(255)"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityName") + .HasColumnType("varchar(255)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("HasBookmarks") + .HasColumnType("tinyint(1)"); + + b.Property("SerializedActivityState") + .HasColumnType("longtext"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("longtext"); + + b.Property("SerializedException") + .HasColumnType("longtext"); + + b.Property("SerializedOutputs") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("SerializedProperties") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedMetadata") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Hash") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityName") + .HasColumnType("varchar(255)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("EventName") + .HasColumnType("varchar(255)"); + + b.Property("Message") + .HasColumnType("longtext"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("Source") + .HasColumnType("longtext"); + + b.Property("Timestamp") + .HasColumnType("datetime(6)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowVersion") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("varchar(255)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("longtext"); + + b.Property("SerializedInput") + .HasColumnType("longtext"); + + b.Property("WorkflowInstanceId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240329200651_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240329200651_V3_1.cs new file mode 100644 index 0000000000..dcda40b232 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240329200651_V3_1.cs @@ -0,0 +1,72 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SerializedActivityStateCompressionAlgorithm", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "SerializedProperties", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "KeyValuePairs", + schema: _schema.Schema, + columns: table => new + { + Key = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SerializedValue = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_KeyValuePairs", x => x.Key); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "KeyValuePairs", + schema: _schema.Schema); + + migrationBuilder.DropColumn( + name: "SerializedActivityStateCompressionAlgorithm", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "SerializedProperties", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240610184652_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240610184652_V3_2.Designer.cs new file mode 100644 index 0000000000..112124942e --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240610184652_V3_2.Designer.cs @@ -0,0 +1,405 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240610184652_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("varchar(255)"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityName") + .HasColumnType("varchar(255)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetime(6)"); + + b.Property("HasBookmarks") + .HasColumnType("tinyint(1)"); + + b.Property("SerializedActivityState") + .HasColumnType("longtext"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("longtext"); + + b.Property("SerializedException") + .HasColumnType("longtext"); + + b.Property("SerializedOutputs") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("SerializedProperties") + .HasColumnType("longtext"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedMetadata") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Hash") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityName") + .HasColumnType("varchar(255)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("EventName") + .HasColumnType("varchar(255)"); + + b.Property("Message") + .HasColumnType("longtext"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("longtext"); + + b.Property("SerializedPayload") + .HasColumnType("longtext"); + + b.Property("Source") + .HasColumnType("longtext"); + + b.Property("Timestamp") + .HasColumnType("datetime(6)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("WorkflowVersion") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ActivityInstanceId") + .HasColumnType("varchar(255)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("CorrelationId") + .HasColumnType("varchar(255)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("longtext"); + + b.Property("SerializedInput") + .HasColumnType("longtext"); + + b.Property("WorkflowInstanceId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240610184652_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240610184652_V3_2.cs new file mode 100644 index 0000000000..891b4ba004 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240610184652_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20241026094715_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240715193237_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20241026094715_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240715193237_V3_3.Designer.cs index c7935f2d6d..38a203f033 100644 --- a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20241026094715_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240715193237_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime { [DbContext(typeof(RuntimeElsaDbContext))] - [Migration("20241026094715_V3_3")] + [Migration("20240715193237_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240715193237_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240715193237_V3_3.cs new file mode 100644 index 0000000000..40811c95f8 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.MySql/Migrations/Runtime/20240715193237_V3_3.cs @@ -0,0 +1,329 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.MySql.Migrations.Runtime +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema); + + migrationBuilder.RenameColumn( + name: "Key", + schema: _schema.Schema, + table: "KeyValuePairs", + newName: "Id"); + + migrationBuilder.RenameColumn( + name: "BookmarkId", + schema: _schema.Schema, + table: "Bookmarks", + newName: "Id"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Triggers", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "KeyValuePairs", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Bookmarks", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "varchar(255)", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "BookmarkQueueItems", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + WorkflowInstanceId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CorrelationId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + BookmarkId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + StimulusHash = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ActivityInstanceId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ActivityTypeName = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + SerializedOptions = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredTrigger_TenantId", + schema: _schema.Schema, + table: "Triggers", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_SerializedKeyValuePair_TenantId", + schema: _schema.Schema, + table: "KeyValuePairs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredBookmark_TenantId", + schema: _schema.Schema, + table: "Bookmarks", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityExecutionRecord_TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityInstanceId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityTypeName", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_BookmarkId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "BookmarkId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CorrelationId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CreatedAt", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_StimulusHash", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "StimulusHash"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_TenantId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_WorkflowInstanceId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "WorkflowInstanceId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BookmarkQueueItems", + schema: _schema.Schema); + + migrationBuilder.DropIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropIndex( + name: "IX_StoredTrigger_TenantId", + schema: _schema.Schema, + table: "Triggers"); + + migrationBuilder.DropIndex( + name: "IX_SerializedKeyValuePair_TenantId", + schema: _schema.Schema, + table: "KeyValuePairs"); + + migrationBuilder.DropIndex( + name: "IX_StoredBookmark_TenantId", + schema: _schema.Schema, + table: "Bookmarks"); + + migrationBuilder.DropIndex( + name: "IX_ActivityExecutionRecord_TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Triggers"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "KeyValuePairs"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Bookmarks"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.RenameColumn( + name: "Id", + schema: _schema.Schema, + table: "KeyValuePairs", + newName: "Key"); + + migrationBuilder.RenameColumn( + name: "Id", + schema: _schema.Schema, + table: "Bookmarks", + newName: "BookmarkId"); + + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ActivityInstanceId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ActivityTypeName = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CorrelationId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ExpiresAt = table.Column(type: "datetime(6)", nullable: false), + Hash = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SerializedBookmarkPayload = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SerializedInput = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + WorkflowInstanceId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20241026094709_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20240715193218_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20241026094709_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20240715193218_V3_3.Designer.cs index a20c8faf4a..c8934ac580 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20241026094709_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20240715193218_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Alterations { [DbContext(typeof(AlterationsElsaDbContext))] - [Migration("20241026094709_V3_3")] + [Migration("20240715193218_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20241026094709_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20240715193218_V3_3.cs similarity index 97% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20241026094709_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20240715193218_V3_3.cs index 97bd8dd6cc..6030152941 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20241026094709_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Alterations/20240715193218_V3_3.cs @@ -1,17 +1,16 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - #nullable disable +using Microsoft.EntityFrameworkCore.Migrations; + namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Alterations { /// public partial class V3_3 : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public V3_3(IElsaDbContextSchema schema) { _schema = schema; } @@ -146,4 +145,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20241026094855_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20240715193612_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20241026094855_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20240715193612_V3_3.Designer.cs index 131d8e6ebe..0af60202a7 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20241026094855_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20240715193612_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Identity { [DbContext(typeof(IdentityElsaDbContext))] - [Migration("20241026094855_V3_3")] + [Migration("20240715193612_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20241026094855_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20240715193612_V3_3.cs similarity index 97% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20241026094855_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20240715193612_V3_3.cs index baed52c99f..a9d4576fc6 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20241026094855_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Identity/20240715193612_V3_3.cs @@ -1,16 +1,16 @@ -using Microsoft.EntityFrameworkCore.Migrations; - #nullable disable +using Microsoft.EntityFrameworkCore.Migrations; + namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Identity { /// public partial class V3_3 : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public V3_3(IElsaDbContextSchema schema) { _schema = schema; } @@ -136,4 +136,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20241026094926_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20240715193721_V3_3.Designer.cs similarity index 98% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20241026094926_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20240715193721_V3_3.Designer.cs index c75742e8d9..f987d873ff 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20241026094926_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20240715193721_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Labels { [DbContext(typeof(LabelsElsaDbContext))] - [Migration("20241026094926_V3_3")] + [Migration("20240715193721_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20241026094926_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20240715193721_V3_3.cs similarity index 95% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20241026094926_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20240715193721_V3_3.cs index dbfb65ccdc..63c4140907 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20241026094926_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Labels/20240715193721_V3_3.cs @@ -1,16 +1,16 @@ -using Microsoft.EntityFrameworkCore.Migrations; - #nullable disable +using Microsoft.EntityFrameworkCore.Migrations; + namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Labels { /// public partial class V3_3 : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public V3_3(IElsaDbContextSchema schema) { _schema = schema; } @@ -91,4 +91,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20241026094823_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20240715193451_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20241026094823_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20240715193451_V3_3.Designer.cs index ac1c0088c9..dc4e5daf46 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20241026094823_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20240715193451_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Management { [DbContext(typeof(ManagementElsaDbContext))] - [Migration("20241026094823_V3_3")] + [Migration("20240715193451_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20241026094823_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20240715193451_V3_3.cs similarity index 93% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20241026094823_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20240715193451_V3_3.cs index 57217614d9..8d1b850de9 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20241026094823_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Management/20240715193451_V3_3.cs @@ -1,17 +1,16 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - #nullable disable +using Microsoft.EntityFrameworkCore.Migrations; + namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Management { /// public partial class V3_3 : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public V3_3(IElsaDbContextSchema schema) { _schema = schema; } @@ -84,7 +83,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowDefinition_DefinitionId_Version", schema: _schema.Schema, table: "WorkflowDefinitions", - columns: new[] { "DefinitionId", "Version" }, + columns: new[] + { + "DefinitionId", "Version" + }, unique: true); migrationBuilder.CreateIndex( @@ -175,19 +177,28 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowInstance_Status_DefinitionId", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "Status", "DefinitionId" }); + columns: new[] + { + "Status", "DefinitionId" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Status_SubStatus", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "Status", "SubStatus" }); + columns: new[] + { + "Status", "SubStatus" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "Status", "SubStatus", "DefinitionId", "Version" }); + columns: new[] + { + "Status", "SubStatus", "DefinitionId", "Version" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_SubStatus", @@ -199,7 +210,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowInstance_SubStatus_DefinitionId", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "SubStatus", "DefinitionId" }); + columns: new[] + { + "SubStatus", "DefinitionId" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_TenantId", @@ -226,4 +240,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20241026094741_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20240715193334_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20241026094741_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20240715193334_V3_3.Designer.cs index 98700ff6fe..739408552e 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20241026094741_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20240715193334_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Runtime { [DbContext(typeof(RuntimeElsaDbContext))] - [Migration("20241026094741_V3_3")] + [Migration("20240715193334_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20241026094741_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20240715193334_V3_3.cs similarity index 96% rename from src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20241026094741_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20240715193334_V3_3.cs index 02acbda177..ac60628ca5 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20241026094741_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Oracle/Migrations/Runtime/20240715193334_V3_3.cs @@ -1,17 +1,16 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - #nullable disable +using Microsoft.EntityFrameworkCore.Migrations; + namespace Elsa.EntityFrameworkCore.Oracle.Migrations.Runtime { /// public partial class V3_3 : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public V3_3(IElsaDbContextSchema schema) { _schema = schema; } @@ -185,7 +184,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion", schema: _schema.Schema, table: "ActivityExecutionRecords", - columns: new[] { "ActivityType", "ActivityTypeVersion" }); + columns: new[] + { + "ActivityType", "ActivityTypeVersion" + }); migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_ActivityTypeVersion", @@ -293,13 +295,19 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_StoredBookmark_ActivityTypeName_Hash", schema: _schema.Schema, table: "Bookmarks", - columns: new[] { "ActivityTypeName", "Hash" }); + columns: new[] + { + "ActivityTypeName", "Hash" + }); migrationBuilder.CreateIndex( name: "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId", schema: _schema.Schema, table: "Bookmarks", - columns: new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }); + columns: new[] + { + "ActivityTypeName", "Hash", "WorkflowInstanceId" + }); migrationBuilder.CreateIndex( name: "IX_StoredBookmark_CreatedAt", @@ -395,7 +403,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion", schema: _schema.Schema, table: "WorkflowExecutionLogRecords", - columns: new[] { "ActivityType", "ActivityTypeVersion" }); + columns: new[] + { + "ActivityType", "ActivityTypeVersion" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_ActivityTypeVersion", @@ -437,7 +448,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowExecutionLogRecord_Timestamp_Sequence", schema: _schema.Schema, table: "WorkflowExecutionLogRecords", - columns: new[] { "Timestamp", "Sequence" }); + columns: new[] + { + "Timestamp", "Sequence" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_WorkflowDefinitionId", @@ -492,4 +506,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20231015122203_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20231015122203_Initial.Designer.cs new file mode 100644 index 0000000000..1680ce79a9 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20231015122203_Initial.Designer.cs @@ -0,0 +1,122 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20231015122203_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedLog") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SerializedAlterations") + .HasColumnType("text"); + + b.Property("SerializedWorkflowInstanceIds") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20241026094700_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20231015122203_Initial.cs similarity index 80% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20241026094700_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20231015122203_Initial.cs index 07c4d3bf9c..e52b60a0e5 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20241026094700_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20231015122203_Initial.cs @@ -1,26 +1,24 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable -#nullable disable +using Microsoft.EntityFrameworkCore.Migrations; namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "AlterationJobs", @@ -30,12 +28,11 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "text", nullable: false), PlanId = table.Column(type: "text", nullable: false), WorkflowInstanceId = table.Column(type: "text", nullable: false), - Status = table.Column(type: "text", nullable: false), + Status = table.Column(type: "integer", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), StartedAt = table.Column(type: "timestamp with time zone", nullable: true), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), - SerializedLog = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + SerializedLog = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -48,13 +45,12 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "text", nullable: false), - Status = table.Column(type: "text", nullable: false), + Status = table.Column(type: "integer", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), StartedAt = table.Column(type: "timestamp with time zone", nullable: true), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), SerializedAlterations = table.Column(type: "text", nullable: true), - SerializedWorkflowInstanceFilter = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + SerializedWorkflowInstanceIds = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -91,12 +87,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "AlterationJobs", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_AlterationJob_TenantId", - schema: _schema.Schema, - table: "AlterationJobs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_AlterationJob_WorkflowInstanceId", schema: _schema.Schema, @@ -126,12 +116,6 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: _schema.Schema, table: "AlterationPlans", column: "Status"); - - migrationBuilder.CreateIndex( - name: "IX_AlterationPlan_TenantId", - schema: _schema.Schema, - table: "AlterationPlans", - column: "TenantId"); } /// @@ -146,4 +130,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240329200643_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240329200643_V3_1.Designer.cs new file mode 100644 index 0000000000..337987fe20 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240329200643_V3_1.Designer.cs @@ -0,0 +1,124 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240329200643_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedLog") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SerializedAlterations") + .HasColumnType("text"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240329200643_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240329200643_V3_1.cs new file mode 100644 index 0000000000..9af96631cd --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240329200643_V3_1.cs @@ -0,0 +1,74 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceIds", + schema: _schema.Schema, + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceFilter"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationPlans", + type: "text", + nullable: false, + oldClrType: typeof(int), + oldType: "integer"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationJobs", + type: "text", + nullable: false, + oldClrType: typeof(int), + oldType: "integer"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceFilter", + schema: _schema.Schema, + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceIds"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationPlans", + type: "integer", + nullable: false, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationJobs", + type: "integer", + nullable: false, + oldClrType: typeof(string), + oldType: "text"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240610184626_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240610184626_V3_2.Designer.cs new file mode 100644 index 0000000000..19292f0429 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240610184626_V3_2.Designer.cs @@ -0,0 +1,124 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240610184626_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedLog") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SerializedAlterations") + .HasColumnType("text"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240610184626_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240610184626_V3_2.cs new file mode 100644 index 0000000000..555b6a38fa --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240610184626_V3_2.cs @@ -0,0 +1,28 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20241026094700_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240715193157_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20241026094700_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240715193157_V3_3.Designer.cs index c1683540a6..0fdd7d4469 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20241026094700_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240715193157_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations { [DbContext(typeof(AlterationsElsaDbContext))] - [Migration("20241026094700_V3_3")] + [Migration("20240715193157_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240715193157_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240715193157_V3_3.cs new file mode 100644 index 0000000000..8e20a2ac33 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Alterations/20240715193157_V3_3.cs @@ -0,0 +1,72 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Alterations +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationPlans", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationJobs", + type: "text", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_AlterationPlan_TenantId", + schema: _schema.Schema, + table: "AlterationPlans", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AlterationJob_TenantId", + schema: _schema.Schema, + table: "AlterationJobs", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_AlterationPlan_TenantId", + schema: _schema.Schema, + table: "AlterationPlans"); + + migrationBuilder.DropIndex( + name: "IX_AlterationJob_TenantId", + schema: _schema.Schema, + table: "AlterationJobs"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationPlans"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationJobs"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20231015122250_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20231015122250_Initial.Designer.cs new file mode 100644 index 0000000000..c180e5415a --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20231015122250_Initial.Designer.cs @@ -0,0 +1,131 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20231015122250_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20241026094850_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20231015122250_Initial.cs similarity index 76% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20241026094850_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20231015122250_Initial.cs index cba8e04c7a..5dbea1fe47 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20241026094850_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20231015122250_Initial.cs @@ -1,25 +1,24 @@ -using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable -#nullable disable +using Microsoft.EntityFrameworkCore.Migrations; namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "Applications", @@ -33,8 +32,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "text", nullable: false), HashedApiKey = table.Column(type: "text", nullable: false), HashedApiKeySalt = table.Column(type: "text", nullable: false), - Roles = table.Column(type: "text", nullable: false), - TenantId = table.Column(type: "text", nullable: true) + Roles = table.Column(type: "text", nullable: false) }, constraints: table => { @@ -48,8 +46,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: false), - Permissions = table.Column(type: "text", nullable: false), - TenantId = table.Column(type: "text", nullable: true) + Permissions = table.Column(type: "text", nullable: false) }, constraints: table => { @@ -65,8 +62,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "text", nullable: false), HashedPassword = table.Column(type: "text", nullable: false), HashedPasswordSalt = table.Column(type: "text", nullable: false), - Roles = table.Column(type: "text", nullable: false), - TenantId = table.Column(type: "text", nullable: true) + Roles = table.Column(type: "text", nullable: false) }, constraints: table => { @@ -87,12 +83,6 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Application_TenantId", - schema: _schema.Schema, - table: "Applications", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_Role_Name", schema: _schema.Schema, @@ -100,24 +90,12 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Role_TenantId", - schema: _schema.Schema, - table: "Roles", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_User_Name", schema: _schema.Schema, table: "Users", column: "Name", unique: true); - - migrationBuilder.CreateIndex( - name: "IX_User_TenantId", - schema: _schema.Schema, - table: "Users", - column: "TenantId"); } /// @@ -136,4 +114,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240329200810_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240329200810_V3_1.Designer.cs new file mode 100644 index 0000000000..d287259bcc --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240329200810_V3_1.Designer.cs @@ -0,0 +1,131 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240329200810_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240329200810_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240329200810_V3_1.cs new file mode 100644 index 0000000000..fab811ce9a --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240329200810_V3_1.cs @@ -0,0 +1,28 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240610184941_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240610184941_V3_2.Designer.cs new file mode 100644 index 0000000000..1b341e0844 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240610184941_V3_2.Designer.cs @@ -0,0 +1,131 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240610184941_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("text") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240610184941_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240610184941_V3_2.cs new file mode 100644 index 0000000000..0e4c591733 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240610184941_V3_2.cs @@ -0,0 +1,28 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20241026094850_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240715193559_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20241026094850_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240715193559_V3_3.Designer.cs index 42775e4700..62860766e4 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20241026094850_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240715193559_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity { [DbContext(typeof(IdentityElsaDbContext))] - [Migration("20241026094850_V3_3")] + [Migration("20240715193559_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240715193559_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240715193559_V3_3.cs new file mode 100644 index 0000000000..94d2a58d8a --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Identity/20240715193559_V3_3.cs @@ -0,0 +1,95 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Identity +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Users", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Roles", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Applications", + type: "text", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_User_TenantId", + schema: _schema.Schema, + table: "Users", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Role_TenantId", + schema: _schema.Schema, + table: "Roles", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Application_TenantId", + schema: _schema.Schema, + table: "Applications", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_User_TenantId", + schema: _schema.Schema, + table: "Users"); + + migrationBuilder.DropIndex( + name: "IX_Role_TenantId", + schema: _schema.Schema, + table: "Roles"); + + migrationBuilder.DropIndex( + name: "IX_Application_TenantId", + schema: _schema.Schema, + table: "Applications"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Users"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Roles"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Applications"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20231015122304_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20231015122304_Initial.Designer.cs new file mode 100644 index 0000000000..c16ca367e4 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20231015122304_Initial.Designer.cs @@ -0,0 +1,85 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20231015122304_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Color") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20241026094919_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20231015122304_Initial.cs similarity index 79% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20241026094919_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20231015122304_Initial.cs index b26dbaa347..d04e1a3d70 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20241026094919_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20231015122304_Initial.cs @@ -1,25 +1,24 @@ -using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable -#nullable disable +using Microsoft.EntityFrameworkCore.Migrations; namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "Labels", @@ -30,8 +29,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "text", nullable: false), NormalizedName = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: true), - Color = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + Color = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -46,8 +44,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "text", nullable: false), WorkflowDefinitionId = table.Column(type: "text", nullable: false), WorkflowDefinitionVersionId = table.Column(type: "text", nullable: false), - LabelId = table.Column(type: "text", nullable: false), - TenantId = table.Column(type: "text", nullable: true) + LabelId = table.Column(type: "text", nullable: false) }, constraints: table => { @@ -60,12 +57,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitionLabels", column: "LabelId"); - migrationBuilder.CreateIndex( - name: "WorkflowDefinitionLabel_TenantId", - schema: _schema.Schema, - table: "WorkflowDefinitionLabels", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "WorkflowDefinitionLabel_WorkflowDefinitionId", schema: _schema.Schema, @@ -91,4 +82,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240329200841_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240329200841_V3_1.Designer.cs new file mode 100644 index 0000000000..4d06c6a81c --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240329200841_V3_1.Designer.cs @@ -0,0 +1,85 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240329200841_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Color") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240329200841_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240329200841_V3_1.cs new file mode 100644 index 0000000000..bafca84d91 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240329200841_V3_1.cs @@ -0,0 +1,28 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240610185037_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240610185037_V3_2.Designer.cs new file mode 100644 index 0000000000..280ac5e3f9 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240610185037_V3_2.Designer.cs @@ -0,0 +1,85 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240610185037_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Color") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240610185037_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240610185037_V3_2.cs new file mode 100644 index 0000000000..d2959dcdcf --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240610185037_V3_2.cs @@ -0,0 +1,28 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20241026094919_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240715193710_V3_3.Designer.cs similarity index 98% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20241026094919_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240715193710_V3_3.Designer.cs index a3a729b3d2..d551f8142a 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20241026094919_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240715193710_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels { [DbContext(typeof(LabelsElsaDbContext))] - [Migration("20241026094919_V3_3")] + [Migration("20240715193710_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240715193710_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240715193710_V3_3.cs new file mode 100644 index 0000000000..7bc6108689 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Labels/20240715193710_V3_3.cs @@ -0,0 +1,61 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Labels +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Labels", + type: "text", + nullable: true); + + migrationBuilder.CreateIndex( + name: "WorkflowDefinitionLabel_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "WorkflowDefinitionLabel_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Labels"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20231015122234_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20231015122234_Initial.Designer.cs new file mode 100644 index 0000000000..d6beea710a --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20231015122234_Initial.Designer.cs @@ -0,0 +1,196 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20231015122234_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("BinaryData") + .HasColumnType("bytea"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("IsLatest") + .HasColumnType("boolean"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("IsReadonly") + .HasColumnType("boolean"); + + b.Property("MaterializerContext") + .HasColumnType("text"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ProviderName") + .HasColumnType("text"); + + b.Property("StringData") + .HasColumnType("text"); + + b.Property("ToolVersion") + .HasColumnType("text"); + + b.Property("UsableAsActivity") + .HasColumnType("boolean"); + + b.Property("Version") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("FinishedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IncidentCount") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Version") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20241026094815_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20231015122234_Initial.cs similarity index 79% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20241026094815_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20231015122234_Initial.cs index 9468dca5cb..6ac1821f7a 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20241026094815_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20231015122234_Initial.cs @@ -1,26 +1,24 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable -#nullable disable +using Microsoft.EntityFrameworkCore.Migrations; namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "WorkflowDefinitions", @@ -38,10 +36,8 @@ protected override void Up(MigrationBuilder migrationBuilder) StringData = table.Column(type: "text", nullable: true), BinaryData = table.Column(type: "bytea", nullable: true), IsReadonly = table.Column(type: "boolean", nullable: false), - IsSystem = table.Column(type: "boolean", nullable: false), Data = table.Column(type: "text", nullable: true), UsableAsActivity = table.Column(type: "boolean", nullable: true), - TenantId = table.Column(type: "text", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), Version = table.Column(type: "integer", nullable: false), IsLatest = table.Column(type: "boolean", nullable: false), @@ -61,19 +57,15 @@ protected override void Up(MigrationBuilder migrationBuilder) DefinitionId = table.Column(type: "text", nullable: false), DefinitionVersionId = table.Column(type: "text", nullable: false), Version = table.Column(type: "integer", nullable: false), - ParentWorkflowInstanceId = table.Column(type: "text", nullable: true), Status = table.Column(type: "text", nullable: false), SubStatus = table.Column(type: "text", nullable: false), CorrelationId = table.Column(type: "text", nullable: true), Name = table.Column(type: "text", nullable: true), IncidentCount = table.Column(type: "integer", nullable: false), - IsSystem = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), FinishedAt = table.Column(type: "timestamp with time zone", nullable: true), - Data = table.Column(type: "text", nullable: true), - DataCompressionAlgorithm = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + Data = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -84,7 +76,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowDefinition_DefinitionId_Version", schema: _schema.Schema, table: "WorkflowDefinitions", - columns: new[] { "DefinitionId", "Version" }, + columns: new[] + { + "DefinitionId", "Version" + }, unique: true); migrationBuilder.CreateIndex( @@ -99,24 +94,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitions", column: "IsPublished"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_IsSystem", - schema: _schema.Schema, - table: "WorkflowDefinitions", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_Name", schema: _schema.Schema, table: "WorkflowDefinitions", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_TenantId", - schema: _schema.Schema, - table: "WorkflowDefinitions", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_UsableAsActivity", schema: _schema.Schema, @@ -153,12 +136,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowInstances", column: "FinishedAt"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_IsSystem", - schema: _schema.Schema, - table: "WorkflowInstances", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Name", schema: _schema.Schema, @@ -175,19 +152,28 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowInstance_Status_DefinitionId", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "Status", "DefinitionId" }); + columns: new[] + { + "Status", "DefinitionId" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Status_SubStatus", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "Status", "SubStatus" }); + columns: new[] + { + "Status", "SubStatus" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "Status", "SubStatus", "DefinitionId", "Version" }); + columns: new[] + { + "Status", "SubStatus", "DefinitionId", "Version" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_SubStatus", @@ -199,13 +185,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowInstance_SubStatus_DefinitionId", schema: _schema.Schema, table: "WorkflowInstances", - columns: new[] { "SubStatus", "DefinitionId" }); - - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_TenantId", - schema: _schema.Schema, - table: "WorkflowInstances", - column: "TenantId"); + columns: new[] + { + "SubStatus", "DefinitionId" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_UpdatedAt", @@ -226,4 +209,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240329200740_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240329200740_V3_1.Designer.cs new file mode 100644 index 0000000000..2aee77f547 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240329200740_V3_1.Designer.cs @@ -0,0 +1,214 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240329200740_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("BinaryData") + .HasColumnType("bytea"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("IsLatest") + .HasColumnType("boolean"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("IsReadonly") + .HasColumnType("boolean"); + + b.Property("IsSystem") + .HasColumnType("boolean"); + + b.Property("MaterializerContext") + .HasColumnType("text"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ProviderName") + .HasColumnType("text"); + + b.Property("StringData") + .HasColumnType("text"); + + b.Property("ToolVersion") + .HasColumnType("text"); + + b.Property("UsableAsActivity") + .HasColumnType("boolean"); + + b.Property("Version") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("text"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("FinishedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IncidentCount") + .HasColumnType("integer"); + + b.Property("IsSystem") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("text"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Version") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240329200740_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240329200740_V3_1.cs new file mode 100644 index 0000000000..af5862c7ad --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240329200740_V3_1.cs @@ -0,0 +1,98 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DataCompressionAlgorithm", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ParentWorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances", + column: "IsSystem"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions", + column: "IsSystem"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "DataCompressionAlgorithm", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "ParentWorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240610184839_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240610184839_V3_2.Designer.cs new file mode 100644 index 0000000000..8484325d55 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240610184839_V3_2.Designer.cs @@ -0,0 +1,214 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240610184839_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("BinaryData") + .HasColumnType("bytea"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("IsLatest") + .HasColumnType("boolean"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("IsReadonly") + .HasColumnType("boolean"); + + b.Property("IsSystem") + .HasColumnType("boolean"); + + b.Property("MaterializerContext") + .HasColumnType("text"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ProviderName") + .HasColumnType("text"); + + b.Property("StringData") + .HasColumnType("text"); + + b.Property("ToolVersion") + .HasColumnType("text"); + + b.Property("UsableAsActivity") + .HasColumnType("boolean"); + + b.Property("Version") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Data") + .HasColumnType("text"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("text"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("FinishedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IncidentCount") + .HasColumnType("integer"); + + b.Property("IsSystem") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("text"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Version") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240610184839_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240610184839_V3_2.cs new file mode 100644 index 0000000000..869e88db2f --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240610184839_V3_2.cs @@ -0,0 +1,28 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20241026094815_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240715193436_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20241026094815_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240715193436_V3_3.Designer.cs index def66f65d2..3ef0dc8f53 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20241026094815_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240715193436_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management { [DbContext(typeof(ManagementElsaDbContext))] - [Migration("20241026094815_V3_3")] + [Migration("20240715193436_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240715193436_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240715193436_V3_3.cs new file mode 100644 index 0000000000..8e376a03ec --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Management/20240715193436_V3_3.cs @@ -0,0 +1,72 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Management +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions", + type: "text", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_TenantId", + schema: _schema.Schema, + table: "WorkflowInstances", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_TenantId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20231024160952_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20231024160952_Initial.Designer.cs new file mode 100644 index 0000000000..8f3674159f --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20231024160952_Initial.Designer.cs @@ -0,0 +1,388 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20231024160952_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityName") + .HasColumnType("text"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityTypeVersion") + .HasColumnType("integer"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("HasBookmarks") + .HasColumnType("boolean"); + + b.Property("SerializedActivityState") + .HasColumnType("text"); + + b.Property("SerializedException") + .HasColumnType("text"); + + b.Property("SerializedOutputs") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .HasColumnType("text"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedMetadata") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Hash") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityName") + .HasColumnType("text"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityTypeVersion") + .HasColumnType("integer"); + + b.Property("EventName") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("text"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("Source") + .HasColumnType("text"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowVersion") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .HasColumnType("text"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("text"); + + b.Property("SerializedInput") + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20241026094735_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20231024160952_Initial.cs similarity index 78% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20241026094735_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20231024160952_Initial.cs index c0c2f247b6..317f1f197c 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20241026094735_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20231024160952_Initial.cs @@ -1,26 +1,24 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable -#nullable disable +using Microsoft.EntityFrameworkCore.Migrations; namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; + private readonly IElsaDbContextSchema _schema; - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "ActivityExecutionRecords", @@ -39,45 +37,21 @@ protected override void Up(MigrationBuilder migrationBuilder) Status = table.Column(type: "text", nullable: false), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), SerializedActivityState = table.Column(type: "text", nullable: true), - SerializedActivityStateCompressionAlgorithm = table.Column(type: "text", nullable: true), SerializedException = table.Column(type: "text", nullable: true), SerializedOutputs = table.Column(type: "text", nullable: true), - SerializedPayload = table.Column(type: "text", nullable: true), - SerializedProperties = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + SerializedPayload = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ActivityExecutionRecords", x => x.Id); }); - migrationBuilder.CreateTable( - name: "BookmarkQueueItems", - schema: _schema.Schema, - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - WorkflowInstanceId = table.Column(type: "text", nullable: true), - CorrelationId = table.Column(type: "text", nullable: true), - BookmarkId = table.Column(type: "text", nullable: true), - StimulusHash = table.Column(type: "text", nullable: true), - ActivityInstanceId = table.Column(type: "text", nullable: true), - ActivityTypeName = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - SerializedOptions = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); - }); - migrationBuilder.CreateTable( name: "Bookmarks", schema: _schema.Schema, columns: table => new { - Id = table.Column(type: "text", nullable: false), + BookmarkId = table.Column(type: "text", nullable: false), ActivityTypeName = table.Column(type: "text", nullable: false), Hash = table.Column(type: "text", nullable: false), WorkflowInstanceId = table.Column(type: "text", nullable: false), @@ -85,26 +59,11 @@ protected override void Up(MigrationBuilder migrationBuilder) CorrelationId = table.Column(type: "text", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), SerializedMetadata = table.Column(type: "text", nullable: true), - SerializedPayload = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + SerializedPayload = table.Column(type: "text", nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Bookmarks", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "KeyValuePairs", - schema: _schema.Schema, - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - SerializedValue = table.Column(type: "text", nullable: false), - TenantId = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_KeyValuePairs", x => x.Id); + table.PrimaryKey("PK_Bookmarks", x => x.BookmarkId); }); migrationBuilder.CreateTable( @@ -118,8 +77,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "text", nullable: false), ActivityId = table.Column(type: "text", nullable: false), Hash = table.Column(type: "text", nullable: true), - SerializedPayload = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + SerializedPayload = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -149,14 +107,34 @@ protected override void Up(MigrationBuilder migrationBuilder) Message = table.Column(type: "text", nullable: true), Source = table.Column(type: "text", nullable: true), SerializedActivityState = table.Column(type: "text", nullable: true), - SerializedPayload = table.Column(type: "text", nullable: true), - TenantId = table.Column(type: "text", nullable: true) + SerializedPayload = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_WorkflowExecutionLogRecords", x => x.Id); }); + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + ActivityTypeName = table.Column(type: "text", nullable: false), + Hash = table.Column(type: "text", nullable: false), + WorkflowInstanceId = table.Column(type: "text", nullable: true), + CorrelationId = table.Column(type: "text", nullable: true), + ActivityInstanceId = table.Column(type: "text", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), + SerializedBookmarkPayload = table.Column(type: "text", nullable: true), + SerializedInput = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }); + migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_ActivityId", schema: _schema.Schema, @@ -185,7 +163,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion", schema: _schema.Schema, table: "ActivityExecutionRecords", - columns: new[] { "ActivityType", "ActivityTypeVersion" }); + columns: new[] + { + "ActivityType", "ActivityTypeVersion" + }); migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_ActivityTypeVersion", @@ -217,66 +198,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "ActivityExecutionRecords", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_ActivityExecutionRecord_TenantId", - schema: _schema.Schema, - table: "ActivityExecutionRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_WorkflowInstanceId", schema: _schema.Schema, table: "ActivityExecutionRecords", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityInstanceId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "ActivityInstanceId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityTypeName", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "ActivityTypeName"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_BookmarkId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "BookmarkId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CorrelationId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "CorrelationId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CreatedAt", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_StimulusHash", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "StimulusHash"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_TenantId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_WorkflowInstanceId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_ActivityInstanceId", schema: _schema.Schema, @@ -293,13 +220,19 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_StoredBookmark_ActivityTypeName_Hash", schema: _schema.Schema, table: "Bookmarks", - columns: new[] { "ActivityTypeName", "Hash" }); + columns: new[] + { + "ActivityTypeName", "Hash" + }); migrationBuilder.CreateIndex( name: "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId", schema: _schema.Schema, table: "Bookmarks", - columns: new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }); + columns: new[] + { + "ActivityTypeName", "Hash", "WorkflowInstanceId" + }); migrationBuilder.CreateIndex( name: "IX_StoredBookmark_CreatedAt", @@ -313,24 +246,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Bookmarks", column: "Hash"); - migrationBuilder.CreateIndex( - name: "IX_StoredBookmark_TenantId", - schema: _schema.Schema, - table: "Bookmarks", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_WorkflowInstanceId", schema: _schema.Schema, table: "Bookmarks", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_SerializedKeyValuePair_TenantId", - schema: _schema.Schema, - table: "KeyValuePairs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_Hash", schema: _schema.Schema, @@ -343,12 +264,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Triggers", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_StoredTrigger_TenantId", - schema: _schema.Schema, - table: "Triggers", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_WorkflowDefinitionId", schema: _schema.Schema, @@ -395,7 +310,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowExecutionLogRecord_ActivityType_ActivityTypeVersion", schema: _schema.Schema, table: "WorkflowExecutionLogRecords", - columns: new[] { "ActivityType", "ActivityTypeVersion" }); + columns: new[] + { + "ActivityType", "ActivityTypeVersion" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_ActivityTypeVersion", @@ -421,12 +339,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowExecutionLogRecords", column: "Sequence"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowExecutionLogRecord_TenantId", - schema: _schema.Schema, - table: "WorkflowExecutionLogRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_Timestamp", schema: _schema.Schema, @@ -437,7 +349,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowExecutionLogRecord_Timestamp_Sequence", schema: _schema.Schema, table: "WorkflowExecutionLogRecords", - columns: new[] { "Timestamp", "Sequence" }); + columns: new[] + { + "Timestamp", "Sequence" + }); migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_WorkflowDefinitionId", @@ -462,6 +377,48 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: _schema.Schema, table: "WorkflowExecutionLogRecords", column: "WorkflowVersion"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); } /// @@ -471,25 +428,21 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "ActivityExecutionRecords", schema: _schema.Schema); - migrationBuilder.DropTable( - name: "BookmarkQueueItems", - schema: _schema.Schema); - migrationBuilder.DropTable( name: "Bookmarks", schema: _schema.Schema); migrationBuilder.DropTable( - name: "KeyValuePairs", + name: "Triggers", schema: _schema.Schema); migrationBuilder.DropTable( - name: "Triggers", + name: "WorkflowExecutionLogRecords", schema: _schema.Schema); migrationBuilder.DropTable( - name: "WorkflowExecutionLogRecords", + name: "WorkflowInboxMessages", schema: _schema.Schema); } } -} +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240329200711_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240329200711_V3_1.Designer.cs new file mode 100644 index 0000000000..ff9ba2df0c --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240329200711_V3_1.Designer.cs @@ -0,0 +1,408 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240329200711_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("text"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityName") + .HasColumnType("text"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityTypeVersion") + .HasColumnType("integer"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("HasBookmarks") + .HasColumnType("boolean"); + + b.Property("SerializedActivityState") + .HasColumnType("text"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("text"); + + b.Property("SerializedException") + .HasColumnType("text"); + + b.Property("SerializedOutputs") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("SerializedProperties") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .HasColumnType("text"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedMetadata") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Hash") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityName") + .HasColumnType("text"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityTypeVersion") + .HasColumnType("integer"); + + b.Property("EventName") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("text"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("Source") + .HasColumnType("text"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowVersion") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .HasColumnType("text"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("text"); + + b.Property("SerializedInput") + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240329200711_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240329200711_V3_1.cs new file mode 100644 index 0000000000..4e49750b25 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240329200711_V3_1.cs @@ -0,0 +1,67 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SerializedActivityStateCompressionAlgorithm", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "SerializedProperties", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "text", + nullable: true); + + migrationBuilder.CreateTable( + name: "KeyValuePairs", + schema: _schema.Schema, + columns: table => new + { + Key = table.Column(type: "text", nullable: false), + SerializedValue = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_KeyValuePairs", x => x.Key); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "KeyValuePairs", + schema: _schema.Schema); + + migrationBuilder.DropColumn( + name: "SerializedActivityStateCompressionAlgorithm", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "SerializedProperties", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240610184748_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240610184748_V3_2.Designer.cs new file mode 100644 index 0000000000..c9cd11aba7 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240610184748_V3_2.Designer.cs @@ -0,0 +1,408 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240610184748_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("text"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityName") + .HasColumnType("text"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityTypeVersion") + .HasColumnType("integer"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("HasBookmarks") + .HasColumnType("boolean"); + + b.Property("SerializedActivityState") + .HasColumnType("text"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("text"); + + b.Property("SerializedException") + .HasColumnType("text"); + + b.Property("SerializedOutputs") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("SerializedProperties") + .HasColumnType("text"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .HasColumnType("text"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedMetadata") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Hash") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityName") + .HasColumnType("text"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityTypeVersion") + .HasColumnType("integer"); + + b.Property("EventName") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("text"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("text"); + + b.Property("SerializedPayload") + .HasColumnType("text"); + + b.Property("Source") + .HasColumnType("text"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkflowVersion") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ActivityInstanceId") + .HasColumnType("text"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CorrelationId") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("text"); + + b.Property("SerializedInput") + .HasColumnType("text"); + + b.Property("WorkflowInstanceId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240610184748_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240610184748_V3_2.cs new file mode 100644 index 0000000000..41dc1bdbd2 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240610184748_V3_2.cs @@ -0,0 +1,28 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20241026094735_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240715193323_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20241026094735_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240715193323_V3_3.Designer.cs index 8d4253a11e..45fe521672 100644 --- a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20241026094735_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240715193323_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime { [DbContext(typeof(RuntimeElsaDbContext))] - [Migration("20241026094735_V3_3")] + [Migration("20240715193323_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240715193323_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240715193323_V3_3.cs new file mode 100644 index 0000000000..8f64fc80d2 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.PostgreSql/Migrations/Runtime/20240715193323_V3_3.cs @@ -0,0 +1,305 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.PostgreSql.Migrations.Runtime +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema); + + migrationBuilder.RenameColumn( + name: "Key", + schema: _schema.Schema, + table: "KeyValuePairs", + newName: "Id"); + + migrationBuilder.RenameColumn( + name: "BookmarkId", + schema: _schema.Schema, + table: "Bookmarks", + newName: "Id"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Triggers", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "KeyValuePairs", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Bookmarks", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "text", + nullable: true); + + migrationBuilder.CreateTable( + name: "BookmarkQueueItems", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + WorkflowInstanceId = table.Column(type: "text", nullable: true), + CorrelationId = table.Column(type: "text", nullable: true), + BookmarkId = table.Column(type: "text", nullable: true), + StimulusHash = table.Column(type: "text", nullable: true), + ActivityInstanceId = table.Column(type: "text", nullable: true), + ActivityTypeName = table.Column(type: "text", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + SerializedOptions = table.Column(type: "text", nullable: true), + TenantId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredTrigger_TenantId", + schema: _schema.Schema, + table: "Triggers", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_SerializedKeyValuePair_TenantId", + schema: _schema.Schema, + table: "KeyValuePairs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredBookmark_TenantId", + schema: _schema.Schema, + table: "Bookmarks", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityExecutionRecord_TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityInstanceId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityTypeName", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_BookmarkId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "BookmarkId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CorrelationId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CreatedAt", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_StimulusHash", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "StimulusHash"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_TenantId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_WorkflowInstanceId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "WorkflowInstanceId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BookmarkQueueItems", + schema: _schema.Schema); + + migrationBuilder.DropIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropIndex( + name: "IX_StoredTrigger_TenantId", + schema: _schema.Schema, + table: "Triggers"); + + migrationBuilder.DropIndex( + name: "IX_SerializedKeyValuePair_TenantId", + schema: _schema.Schema, + table: "KeyValuePairs"); + + migrationBuilder.DropIndex( + name: "IX_StoredBookmark_TenantId", + schema: _schema.Schema, + table: "Bookmarks"); + + migrationBuilder.DropIndex( + name: "IX_ActivityExecutionRecord_TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Triggers"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "KeyValuePairs"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Bookmarks"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.RenameColumn( + name: "Id", + schema: _schema.Schema, + table: "KeyValuePairs", + newName: "Key"); + + migrationBuilder.RenameColumn( + name: "Id", + schema: _schema.Schema, + table: "Bookmarks", + newName: "BookmarkId"); + + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + ActivityInstanceId = table.Column(type: "text", nullable: true), + ActivityTypeName = table.Column(type: "text", nullable: false), + CorrelationId = table.Column(type: "text", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), + Hash = table.Column(type: "text", nullable: false), + SerializedBookmarkPayload = table.Column(type: "text", nullable: true), + SerializedInput = table.Column(type: "text", nullable: true), + WorkflowInstanceId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20231015122155_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20231015122155_Initial.Designer.cs new file mode 100644 index 0000000000..84e0a385e3 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20231015122155_Initial.Designer.cs @@ -0,0 +1,122 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20231015122155_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedLog") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("SerializedAlterations") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedWorkflowInstanceIds") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20241026094648_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20231015122155_Initial.cs similarity index 78% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20241026094648_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20231015122155_Initial.cs index 9c478f9d45..7e0abe5647 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20241026094648_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20231015122155_Initial.cs @@ -1,26 +1,22 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "AlterationJobs", @@ -30,12 +26,11 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "nvarchar(450)", nullable: false), PlanId = table.Column(type: "nvarchar(450)", nullable: false), WorkflowInstanceId = table.Column(type: "nvarchar(450)", nullable: false), - Status = table.Column(type: "nvarchar(450)", nullable: false), + Status = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetimeoffset", nullable: false), StartedAt = table.Column(type: "datetimeoffset", nullable: true), CompletedAt = table.Column(type: "datetimeoffset", nullable: true), - SerializedLog = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + SerializedLog = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -48,13 +43,12 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "nvarchar(450)", nullable: false), - Status = table.Column(type: "nvarchar(450)", nullable: false), + Status = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetimeoffset", nullable: false), StartedAt = table.Column(type: "datetimeoffset", nullable: true), CompletedAt = table.Column(type: "datetimeoffset", nullable: true), SerializedAlterations = table.Column(type: "nvarchar(max)", nullable: true), - SerializedWorkflowInstanceFilter = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + SerializedWorkflowInstanceIds = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -91,12 +85,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "AlterationJobs", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_AlterationJob_TenantId", - schema: _schema.Schema, - table: "AlterationJobs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_AlterationJob_WorkflowInstanceId", schema: _schema.Schema, @@ -126,12 +114,6 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: _schema.Schema, table: "AlterationPlans", column: "Status"); - - migrationBuilder.CreateIndex( - name: "IX_AlterationPlan_TenantId", - schema: _schema.Schema, - table: "AlterationPlans", - column: "TenantId"); } /// diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240329200626_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240329200626_V3_1.Designer.cs new file mode 100644 index 0000000000..4d9c32aefc --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240329200626_V3_1.Designer.cs @@ -0,0 +1,124 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240329200626_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedLog") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("SerializedAlterations") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240329200626_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240329200626_V3_1.cs new file mode 100644 index 0000000000..6da00c13d0 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240329200626_V3_1.cs @@ -0,0 +1,74 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceIds", + schema: _schema.Schema, + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceFilter"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationPlans", + type: "nvarchar(450)", + nullable: false, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationJobs", + type: "nvarchar(450)", + nullable: false, + oldClrType: typeof(int), + oldType: "int"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceFilter", + schema: _schema.Schema, + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceIds"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationPlans", + type: "int", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(450)"); + + migrationBuilder.AlterColumn( + name: "Status", + schema: _schema.Schema, + table: "AlterationJobs", + type: "int", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(450)"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240610184545_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240610184545_V3_2.Designer.cs new file mode 100644 index 0000000000..bc6ee01d2f --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240610184545_V3_2.Designer.cs @@ -0,0 +1,124 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240610184545_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedLog") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("SerializedAlterations") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240610184545_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240610184545_V3_2.cs new file mode 100644 index 0000000000..7aa2f7e996 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240610184545_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20241026094648_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240715193109_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20241026094648_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240715193109_V3_3.Designer.cs index 39a19aad36..9837b6a251 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20241026094648_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240715193109_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations { [DbContext(typeof(AlterationsElsaDbContext))] - [Migration("20241026094648_V3_3")] + [Migration("20240715193109_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240715193109_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240715193109_V3_3.cs new file mode 100644 index 0000000000..82772f38d4 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Alterations/20240715193109_V3_3.cs @@ -0,0 +1,72 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Alterations +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationPlans", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationJobs", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_AlterationPlan_TenantId", + schema: _schema.Schema, + table: "AlterationPlans", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AlterationJob_TenantId", + schema: _schema.Schema, + table: "AlterationJobs", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_AlterationPlan_TenantId", + schema: _schema.Schema, + table: "AlterationPlans"); + + migrationBuilder.DropIndex( + name: "IX_AlterationJob_TenantId", + schema: _schema.Schema, + table: "AlterationJobs"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationPlans"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "AlterationJobs"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20231015122242_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20231015122242_Initial.Designer.cs new file mode 100644 index 0000000000..5eb6352130 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20231015122242_Initial.Designer.cs @@ -0,0 +1,131 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20231015122242_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20241026094839_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20231015122242_Initial.cs similarity index 76% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20241026094839_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20231015122242_Initial.cs index 8207f6045a..96d07566fe 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20241026094839_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20231015122242_Initial.cs @@ -1,25 +1,22 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "Applications", @@ -33,8 +30,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "nvarchar(450)", nullable: false), HashedApiKey = table.Column(type: "nvarchar(max)", nullable: false), HashedApiKeySalt = table.Column(type: "nvarchar(max)", nullable: false), - Roles = table.Column(type: "nvarchar(max)", nullable: false), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + Roles = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { @@ -48,8 +44,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "nvarchar(450)", nullable: false), Name = table.Column(type: "nvarchar(450)", nullable: false), - Permissions = table.Column(type: "nvarchar(max)", nullable: false), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + Permissions = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { @@ -65,8 +60,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "nvarchar(450)", nullable: false), HashedPassword = table.Column(type: "nvarchar(max)", nullable: false), HashedPasswordSalt = table.Column(type: "nvarchar(max)", nullable: false), - Roles = table.Column(type: "nvarchar(max)", nullable: false), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + Roles = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { @@ -87,12 +81,6 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Application_TenantId", - schema: _schema.Schema, - table: "Applications", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_Role_Name", schema: _schema.Schema, @@ -100,24 +88,12 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Role_TenantId", - schema: _schema.Schema, - table: "Roles", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_User_Name", schema: _schema.Schema, table: "Users", column: "Name", unique: true); - - migrationBuilder.CreateIndex( - name: "IX_User_TenantId", - schema: _schema.Schema, - table: "Users", - column: "TenantId"); } /// diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240329200753_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240329200753_V3_1.Designer.cs new file mode 100644 index 0000000000..0322db1ab3 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240329200753_V3_1.Designer.cs @@ -0,0 +1,131 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240329200753_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240329200753_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240329200753_V3_1.cs new file mode 100644 index 0000000000..651a17c81f --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240329200753_V3_1.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240610184919_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240610184919_V3_2.Designer.cs new file mode 100644 index 0000000000..0ba11aa949 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240610184919_V3_2.Designer.cs @@ -0,0 +1,131 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240610184919_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240610184919_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240610184919_V3_2.cs new file mode 100644 index 0000000000..f174820f57 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240610184919_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20241026094839_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240715193525_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20241026094839_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240715193525_V3_3.Designer.cs index cbef5ae6ae..4fe2276191 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20241026094839_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240715193525_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity { [DbContext(typeof(IdentityElsaDbContext))] - [Migration("20241026094839_V3_3")] + [Migration("20240715193525_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240715193525_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240715193525_V3_3.cs new file mode 100644 index 0000000000..e7fd32356c --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Identity/20240715193525_V3_3.cs @@ -0,0 +1,95 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Identity +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Users", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Roles", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Applications", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_User_TenantId", + schema: _schema.Schema, + table: "Users", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Role_TenantId", + schema: _schema.Schema, + table: "Roles", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Application_TenantId", + schema: _schema.Schema, + table: "Applications", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_User_TenantId", + schema: _schema.Schema, + table: "Users"); + + migrationBuilder.DropIndex( + name: "IX_Role_TenantId", + schema: _schema.Schema, + table: "Roles"); + + migrationBuilder.DropIndex( + name: "IX_Application_TenantId", + schema: _schema.Schema, + table: "Applications"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Users"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Roles"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Applications"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20231015122257_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20231015122257_Initial.Designer.cs new file mode 100644 index 0000000000..a6ab2f4615 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20231015122257_Initial.Designer.cs @@ -0,0 +1,85 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20231015122257_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Color") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20241026094908_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20231015122257_Initial.cs similarity index 78% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20241026094908_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20231015122257_Initial.cs index 9cee090ed3..fe96905152 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20241026094908_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20231015122257_Initial.cs @@ -1,25 +1,22 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "Labels", @@ -30,8 +27,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "nvarchar(max)", nullable: false), NormalizedName = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: true), - Color = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(max)", nullable: true) + Color = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -46,8 +42,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "nvarchar(450)", nullable: false), WorkflowDefinitionId = table.Column(type: "nvarchar(450)", nullable: false), WorkflowDefinitionVersionId = table.Column(type: "nvarchar(450)", nullable: false), - LabelId = table.Column(type: "nvarchar(450)", nullable: false), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + LabelId = table.Column(type: "nvarchar(450)", nullable: false) }, constraints: table => { @@ -60,12 +55,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitionLabels", column: "LabelId"); - migrationBuilder.CreateIndex( - name: "WorkflowDefinitionLabel_TenantId", - schema: _schema.Schema, - table: "WorkflowDefinitionLabels", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "WorkflowDefinitionLabel_WorkflowDefinitionId", schema: _schema.Schema, diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240329200825_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240329200825_V3_1.Designer.cs new file mode 100644 index 0000000000..33710032b2 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240329200825_V3_1.Designer.cs @@ -0,0 +1,85 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240329200825_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Color") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240329200825_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240329200825_V3_1.cs new file mode 100644 index 0000000000..d7253cb7a4 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240329200825_V3_1.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240610185009_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240610185009_V3_2.Designer.cs new file mode 100644 index 0000000000..0667dd0d95 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240610185009_V3_2.Designer.cs @@ -0,0 +1,85 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240610185009_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Color") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Labels", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240610185009_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240610185009_V3_2.cs new file mode 100644 index 0000000000..ef6e41cbed --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240610185009_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20241026094908_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240715193645_V3_3.Designer.cs similarity index 98% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20241026094908_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240715193645_V3_3.Designer.cs index 41f2fe3679..2878871fa4 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20241026094908_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240715193645_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels { [DbContext(typeof(LabelsElsaDbContext))] - [Migration("20241026094908_V3_3")] + [Migration("20240715193645_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240715193645_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240715193645_V3_3.cs new file mode 100644 index 0000000000..107bc93f94 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Labels/20240715193645_V3_3.cs @@ -0,0 +1,61 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Labels +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Labels", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.CreateIndex( + name: "WorkflowDefinitionLabel_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "WorkflowDefinitionLabel_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Labels"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20231015122227_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20231015122227_Initial.Designer.cs new file mode 100644 index 0000000000..cc99eca0a5 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20231015122227_Initial.Designer.cs @@ -0,0 +1,196 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20231015122227_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("BinaryData") + .HasColumnType("varbinary(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsLatest") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("IsReadonly") + .HasColumnType("bit"); + + b.Property("MaterializerContext") + .HasColumnType("nvarchar(max)"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderName") + .HasColumnType("nvarchar(max)"); + + b.Property("StringData") + .HasColumnType("nvarchar(max)"); + + b.Property("ToolVersion") + .HasColumnType("nvarchar(max)"); + + b.Property("UsableAsActivity") + .HasColumnType("bit"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(450)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FinishedAt") + .HasColumnType("datetimeoffset"); + + b.Property("IncidentCount") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("UpdatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20241026094755_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20231015122227_Initial.cs similarity index 81% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20241026094755_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20231015122227_Initial.cs index 8b5594429f..372bead26c 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20241026094755_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20231015122227_Initial.cs @@ -1,30 +1,26 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "WorkflowDefinitions", - schema: _schema.Schema, + schema: _schema.Schema , columns: table => new { Id = table.Column(type: "nvarchar(450)", nullable: false), @@ -38,10 +34,8 @@ protected override void Up(MigrationBuilder migrationBuilder) StringData = table.Column(type: "nvarchar(max)", nullable: true), BinaryData = table.Column(type: "varbinary(max)", nullable: true), IsReadonly = table.Column(type: "bit", nullable: false), - IsSystem = table.Column(type: "bit", nullable: false), Data = table.Column(type: "nvarchar(max)", nullable: true), UsableAsActivity = table.Column(type: "bit", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true), CreatedAt = table.Column(type: "datetimeoffset", nullable: false), Version = table.Column(type: "int", nullable: false), IsLatest = table.Column(type: "bit", nullable: false), @@ -61,19 +55,15 @@ protected override void Up(MigrationBuilder migrationBuilder) DefinitionId = table.Column(type: "nvarchar(450)", nullable: false), DefinitionVersionId = table.Column(type: "nvarchar(max)", nullable: false), Version = table.Column(type: "int", nullable: false), - ParentWorkflowInstanceId = table.Column(type: "nvarchar(max)", nullable: true), Status = table.Column(type: "nvarchar(450)", nullable: false), SubStatus = table.Column(type: "nvarchar(450)", nullable: false), CorrelationId = table.Column(type: "nvarchar(450)", nullable: true), Name = table.Column(type: "nvarchar(450)", nullable: true), IncidentCount = table.Column(type: "int", nullable: false), - IsSystem = table.Column(type: "bit", nullable: false), CreatedAt = table.Column(type: "datetimeoffset", nullable: false), UpdatedAt = table.Column(type: "datetimeoffset", nullable: false), FinishedAt = table.Column(type: "datetimeoffset", nullable: true), - Data = table.Column(type: "nvarchar(max)", nullable: true), - DataCompressionAlgorithm = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + Data = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -99,24 +89,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitions", column: "IsPublished"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_IsSystem", - schema: _schema.Schema, - table: "WorkflowDefinitions", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_Name", schema: _schema.Schema, table: "WorkflowDefinitions", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_TenantId", - schema: _schema.Schema, - table: "WorkflowDefinitions", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_UsableAsActivity", schema: _schema.Schema, @@ -153,12 +131,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowInstances", column: "FinishedAt"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_IsSystem", - schema: _schema.Schema, - table: "WorkflowInstances", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Name", schema: _schema.Schema, @@ -201,12 +173,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowInstances", columns: new[] { "SubStatus", "DefinitionId" }); - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_TenantId", - schema: _schema.Schema, - table: "WorkflowInstances", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_UpdatedAt", schema: _schema.Schema, diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240329200727_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240329200727_V3_1.Designer.cs new file mode 100644 index 0000000000..a23cc5bd78 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240329200727_V3_1.Designer.cs @@ -0,0 +1,214 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240329200727_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("BinaryData") + .HasColumnType("varbinary(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsLatest") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("IsReadonly") + .HasColumnType("bit"); + + b.Property("IsSystem") + .HasColumnType("bit"); + + b.Property("MaterializerContext") + .HasColumnType("nvarchar(max)"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderName") + .HasColumnType("nvarchar(max)"); + + b.Property("StringData") + .HasColumnType("nvarchar(max)"); + + b.Property("ToolVersion") + .HasColumnType("nvarchar(max)"); + + b.Property("UsableAsActivity") + .HasColumnType("bit"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(450)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("nvarchar(max)"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FinishedAt") + .HasColumnType("datetimeoffset"); + + b.Property("IncidentCount") + .HasColumnType("int"); + + b.Property("IsSystem") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("UpdatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240329200727_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240329200727_V3_1.cs new file mode 100644 index 0000000000..4ab3277127 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240329200727_V3_1.cs @@ -0,0 +1,98 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DataCompressionAlgorithm", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ParentWorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances", + column: "IsSystem"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions", + column: "IsSystem"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "DataCompressionAlgorithm", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "ParentWorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240610184814_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240610184814_V3_2.Designer.cs new file mode 100644 index 0000000000..fd6cb595b1 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240610184814_V3_2.Designer.cs @@ -0,0 +1,214 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240610184814_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("BinaryData") + .HasColumnType("varbinary(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsLatest") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("IsReadonly") + .HasColumnType("bit"); + + b.Property("IsSystem") + .HasColumnType("bit"); + + b.Property("MaterializerContext") + .HasColumnType("nvarchar(max)"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderName") + .HasColumnType("nvarchar(max)"); + + b.Property("StringData") + .HasColumnType("nvarchar(max)"); + + b.Property("ToolVersion") + .HasColumnType("nvarchar(max)"); + + b.Property("UsableAsActivity") + .HasColumnType("bit"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(450)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("nvarchar(max)"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FinishedAt") + .HasColumnType("datetimeoffset"); + + b.Property("IncidentCount") + .HasColumnType("int"); + + b.Property("IsSystem") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("UpdatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240610184814_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240610184814_V3_2.cs new file mode 100644 index 0000000000..a2bab765bf --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240610184814_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20241026094755_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240715193404_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20241026094755_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240715193404_V3_3.Designer.cs index f313cc583c..933ebde2ab 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20241026094755_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240715193404_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management { [DbContext(typeof(ManagementElsaDbContext))] - [Migration("20241026094755_V3_3")] + [Migration("20240715193404_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240715193404_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240715193404_V3_3.cs new file mode 100644 index 0000000000..a80f890391 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Management/20240715193404_V3_3.cs @@ -0,0 +1,72 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowInstances", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_TenantId", + schema: _schema.Schema, + table: "WorkflowInstances", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_TenantId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowDefinitions"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20231024160944_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20231024160944_Initial.Designer.cs new file mode 100644 index 0000000000..fc51ee6819 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20231024160944_Initial.Designer.cs @@ -0,0 +1,388 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20231024160944_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityName") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("HasBookmarks") + .HasColumnType("bit"); + + b.Property("SerializedActivityState") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedException") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedOutputs") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedMetadata") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Hash") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityName") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("EventName") + .HasColumnType("nvarchar(450)"); + + b.Property("Message") + .HasColumnType("nvarchar(max)"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("Source") + .HasColumnType("nvarchar(max)"); + + b.Property("Timestamp") + .HasColumnType("datetimeoffset"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowVersion") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(450)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("ExpiresAt") + .HasColumnType("datetimeoffset"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedInput") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowInstanceId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20241026094722_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20231024160944_Initial.cs similarity index 79% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20241026094722_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20231024160944_Initial.cs index 84a17b8f35..899bf632b8 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20241026094722_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20231024160944_Initial.cs @@ -1,26 +1,22 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) + private readonly IElsaDbContextSchema _schema; + public Initial(IElsaDbContextSchema schema) { - _schema = schema; + _schema = schema ?? throw new ArgumentNullException(nameof(schema)); } - /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Elsa"); + name: _schema.Schema); migrationBuilder.CreateTable( name: "ActivityExecutionRecords", @@ -39,45 +35,21 @@ protected override void Up(MigrationBuilder migrationBuilder) Status = table.Column(type: "nvarchar(450)", nullable: false), CompletedAt = table.Column(type: "datetimeoffset", nullable: true), SerializedActivityState = table.Column(type: "nvarchar(max)", nullable: true), - SerializedActivityStateCompressionAlgorithm = table.Column(type: "nvarchar(max)", nullable: true), SerializedException = table.Column(type: "nvarchar(max)", nullable: true), SerializedOutputs = table.Column(type: "nvarchar(max)", nullable: true), - SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true), - SerializedProperties = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ActivityExecutionRecords", x => x.Id); }); - migrationBuilder.CreateTable( - name: "BookmarkQueueItems", - schema: _schema.Schema, - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - WorkflowInstanceId = table.Column(type: "nvarchar(450)", nullable: true), - CorrelationId = table.Column(type: "nvarchar(450)", nullable: true), - BookmarkId = table.Column(type: "nvarchar(450)", nullable: true), - StimulusHash = table.Column(type: "nvarchar(450)", nullable: true), - ActivityInstanceId = table.Column(type: "nvarchar(450)", nullable: true), - ActivityTypeName = table.Column(type: "nvarchar(450)", nullable: true), - CreatedAt = table.Column(type: "datetimeoffset", nullable: false), - SerializedOptions = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); - }); - migrationBuilder.CreateTable( name: "Bookmarks", schema: _schema.Schema, columns: table => new { - Id = table.Column(type: "nvarchar(450)", nullable: false), + BookmarkId = table.Column(type: "nvarchar(450)", nullable: false), ActivityTypeName = table.Column(type: "nvarchar(450)", nullable: false), Hash = table.Column(type: "nvarchar(450)", nullable: false), WorkflowInstanceId = table.Column(type: "nvarchar(450)", nullable: false), @@ -85,26 +57,11 @@ protected override void Up(MigrationBuilder migrationBuilder) CorrelationId = table.Column(type: "nvarchar(max)", nullable: true), CreatedAt = table.Column(type: "datetimeoffset", nullable: false), SerializedMetadata = table.Column(type: "nvarchar(max)", nullable: true), - SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Bookmarks", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "KeyValuePairs", - schema: _schema.Schema, - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - SerializedValue = table.Column(type: "nvarchar(max)", nullable: false), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { - table.PrimaryKey("PK_KeyValuePairs", x => x.Id); + table.PrimaryKey("PK_Bookmarks", x => x.BookmarkId); }); migrationBuilder.CreateTable( @@ -118,8 +75,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "nvarchar(450)", nullable: false), ActivityId = table.Column(type: "nvarchar(max)", nullable: false), Hash = table.Column(type: "nvarchar(450)", nullable: true), - SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -149,14 +105,34 @@ protected override void Up(MigrationBuilder migrationBuilder) Message = table.Column(type: "nvarchar(max)", nullable: true), Source = table.Column(type: "nvarchar(max)", nullable: true), SerializedActivityState = table.Column(type: "nvarchar(max)", nullable: true), - SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true), - TenantId = table.Column(type: "nvarchar(450)", nullable: true) + SerializedPayload = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_WorkflowExecutionLogRecords", x => x.Id); }); + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "nvarchar(450)", nullable: false), + ActivityTypeName = table.Column(type: "nvarchar(450)", nullable: false), + Hash = table.Column(type: "nvarchar(450)", nullable: false), + WorkflowInstanceId = table.Column(type: "nvarchar(450)", nullable: true), + CorrelationId = table.Column(type: "nvarchar(450)", nullable: true), + ActivityInstanceId = table.Column(type: "nvarchar(450)", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false), + ExpiresAt = table.Column(type: "datetimeoffset", nullable: false), + SerializedBookmarkPayload = table.Column(type: "nvarchar(max)", nullable: true), + SerializedInput = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }); + migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_ActivityId", schema: _schema.Schema, @@ -217,66 +193,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "ActivityExecutionRecords", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_ActivityExecutionRecord_TenantId", - schema: _schema.Schema, - table: "ActivityExecutionRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_WorkflowInstanceId", schema: _schema.Schema, table: "ActivityExecutionRecords", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityInstanceId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "ActivityInstanceId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityTypeName", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "ActivityTypeName"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_BookmarkId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "BookmarkId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CorrelationId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "CorrelationId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CreatedAt", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_StimulusHash", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "StimulusHash"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_TenantId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_WorkflowInstanceId", - schema: _schema.Schema, - table: "BookmarkQueueItems", - column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_ActivityInstanceId", schema: _schema.Schema, @@ -313,24 +235,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Bookmarks", column: "Hash"); - migrationBuilder.CreateIndex( - name: "IX_StoredBookmark_TenantId", - schema: _schema.Schema, - table: "Bookmarks", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_WorkflowInstanceId", schema: _schema.Schema, table: "Bookmarks", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_SerializedKeyValuePair_TenantId", - schema: _schema.Schema, - table: "KeyValuePairs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_Hash", schema: _schema.Schema, @@ -343,12 +253,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Triggers", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_StoredTrigger_TenantId", - schema: _schema.Schema, - table: "Triggers", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_WorkflowDefinitionId", schema: _schema.Schema, @@ -421,12 +325,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowExecutionLogRecords", column: "Sequence"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowExecutionLogRecord_TenantId", - schema: _schema.Schema, - table: "WorkflowExecutionLogRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_Timestamp", schema: _schema.Schema, @@ -462,6 +360,48 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: _schema.Schema, table: "WorkflowExecutionLogRecords", column: "WorkflowVersion"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); } /// @@ -471,24 +411,20 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "ActivityExecutionRecords", schema: _schema.Schema); - migrationBuilder.DropTable( - name: "BookmarkQueueItems", - schema: _schema.Schema); - migrationBuilder.DropTable( name: "Bookmarks", schema: _schema.Schema); migrationBuilder.DropTable( - name: "KeyValuePairs", + name: "Triggers", schema: _schema.Schema); migrationBuilder.DropTable( - name: "Triggers", + name: "WorkflowExecutionLogRecords", schema: _schema.Schema); migrationBuilder.DropTable( - name: "WorkflowExecutionLogRecords", + name: "WorkflowInboxMessages", schema: _schema.Schema); } } diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240329200657_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240329200657_V3_1.Designer.cs new file mode 100644 index 0000000000..2c345fdd73 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240329200657_V3_1.Designer.cs @@ -0,0 +1,408 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240329200657_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityName") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("HasBookmarks") + .HasColumnType("bit"); + + b.Property("SerializedActivityState") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedException") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedOutputs") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedMetadata") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Hash") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityName") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("EventName") + .HasColumnType("nvarchar(450)"); + + b.Property("Message") + .HasColumnType("nvarchar(max)"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("Source") + .HasColumnType("nvarchar(max)"); + + b.Property("Timestamp") + .HasColumnType("datetimeoffset"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowVersion") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(450)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("ExpiresAt") + .HasColumnType("datetimeoffset"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedInput") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowInstanceId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240329200657_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240329200657_V3_1.cs new file mode 100644 index 0000000000..abaac578e4 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240329200657_V3_1.cs @@ -0,0 +1,67 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SerializedActivityStateCompressionAlgorithm", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "SerializedProperties", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.CreateTable( + name: "KeyValuePairs", + schema: _schema.Schema, + columns: table => new + { + Key = table.Column(type: "nvarchar(450)", nullable: false), + SerializedValue = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_KeyValuePairs", x => x.Key); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "KeyValuePairs", + schema: _schema.Schema); + + migrationBuilder.DropColumn( + name: "SerializedActivityStateCompressionAlgorithm", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "SerializedProperties", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240610184719_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240610184719_V3_2.Designer.cs new file mode 100644 index 0000000000..4112cb97da --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240610184719_V3_2.Designer.cs @@ -0,0 +1,408 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240610184719_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Elsa") + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityName") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetimeoffset"); + + b.Property("HasBookmarks") + .HasColumnType("bit"); + + b.Property("SerializedActivityState") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedException") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedOutputs") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("StartedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedMetadata") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Hash") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityName") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeVersion") + .HasColumnType("int"); + + b.Property("EventName") + .HasColumnType("nvarchar(450)"); + + b.Property("Message") + .HasColumnType("nvarchar(max)"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("SerializedActivityState") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("Source") + .HasColumnType("nvarchar(max)"); + + b.Property("Timestamp") + .HasColumnType("datetimeoffset"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowVersion") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords", "Elsa"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityInstanceId") + .HasColumnType("nvarchar(450)"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(450)"); + + b.Property("CreatedAt") + .HasColumnType("datetimeoffset"); + + b.Property("ExpiresAt") + .HasColumnType("datetimeoffset"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedInput") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkflowInstanceId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages", "Elsa"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240610184719_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240610184719_V3_2.cs new file mode 100644 index 0000000000..67ba36b5f0 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240610184719_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20241026094722_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240715193252_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20241026094722_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240715193252_V3_3.Designer.cs index c2307bc357..ee7ec51d87 100644 --- a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20241026094722_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240715193252_V3_3.Designer.cs @@ -12,7 +12,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime { [DbContext(typeof(RuntimeElsaDbContext))] - [Migration("20241026094722_V3_3")] + [Migration("20240715193252_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240715193252_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240715193252_V3_3.cs new file mode 100644 index 0000000000..27266c29ab --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.SqlServer/Migrations/Runtime/20240715193252_V3_3.cs @@ -0,0 +1,305 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Runtime +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema); + + migrationBuilder.RenameColumn( + name: "Key", + schema: _schema.Schema, + table: "KeyValuePairs", + newName: "Id"); + + migrationBuilder.RenameColumn( + name: "BookmarkId", + schema: _schema.Schema, + table: "Bookmarks", + newName: "Id"); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Triggers", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "KeyValuePairs", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Bookmarks", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.CreateTable( + name: "BookmarkQueueItems", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "nvarchar(450)", nullable: false), + WorkflowInstanceId = table.Column(type: "nvarchar(450)", nullable: true), + CorrelationId = table.Column(type: "nvarchar(450)", nullable: true), + BookmarkId = table.Column(type: "nvarchar(450)", nullable: true), + StimulusHash = table.Column(type: "nvarchar(450)", nullable: true), + ActivityInstanceId = table.Column(type: "nvarchar(450)", nullable: true), + ActivityTypeName = table.Column(type: "nvarchar(450)", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false), + SerializedOptions = table.Column(type: "nvarchar(max)", nullable: true), + TenantId = table.Column(type: "nvarchar(450)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredTrigger_TenantId", + schema: _schema.Schema, + table: "Triggers", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_SerializedKeyValuePair_TenantId", + schema: _schema.Schema, + table: "KeyValuePairs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredBookmark_TenantId", + schema: _schema.Schema, + table: "Bookmarks", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityExecutionRecord_TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityInstanceId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityTypeName", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_BookmarkId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "BookmarkId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CorrelationId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CreatedAt", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_StimulusHash", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "StimulusHash"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_TenantId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_WorkflowInstanceId", + schema: _schema.Schema, + table: "BookmarkQueueItems", + column: "WorkflowInstanceId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BookmarkQueueItems", + schema: _schema.Schema); + + migrationBuilder.DropIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropIndex( + name: "IX_StoredTrigger_TenantId", + schema: _schema.Schema, + table: "Triggers"); + + migrationBuilder.DropIndex( + name: "IX_SerializedKeyValuePair_TenantId", + schema: _schema.Schema, + table: "KeyValuePairs"); + + migrationBuilder.DropIndex( + name: "IX_StoredBookmark_TenantId", + schema: _schema.Schema, + table: "Bookmarks"); + + migrationBuilder.DropIndex( + name: "IX_ActivityExecutionRecord_TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Triggers"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "KeyValuePairs"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "Bookmarks"); + + migrationBuilder.DropColumn( + name: "TenantId", + schema: _schema.Schema, + table: "ActivityExecutionRecords"); + + migrationBuilder.RenameColumn( + name: "Id", + schema: _schema.Schema, + table: "KeyValuePairs", + newName: "Key"); + + migrationBuilder.RenameColumn( + name: "Id", + schema: _schema.Schema, + table: "Bookmarks", + newName: "BookmarkId"); + + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + schema: _schema.Schema, + columns: table => new + { + Id = table.Column(type: "nvarchar(450)", nullable: false), + ActivityInstanceId = table.Column(type: "nvarchar(450)", nullable: true), + ActivityTypeName = table.Column(type: "nvarchar(450)", nullable: false), + CorrelationId = table.Column(type: "nvarchar(450)", nullable: true), + CreatedAt = table.Column(type: "datetimeoffset", nullable: false), + ExpiresAt = table.Column(type: "datetimeoffset", nullable: false), + Hash = table.Column(type: "nvarchar(450)", nullable: false), + SerializedBookmarkPayload = table.Column(type: "nvarchar(max)", nullable: true), + SerializedInput = table.Column(type: "nvarchar(max)", nullable: true), + WorkflowInstanceId = table.Column(type: "nvarchar(450)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + schema: _schema.Schema, + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20231015122159_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20231015122159_Initial.Designer.cs new file mode 100644 index 0000000000..2edc7c955c --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20231015122159_Initial.Designer.cs @@ -0,0 +1,117 @@ +// +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20231015122159_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.11"); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedLog") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedAlterations") + .HasColumnType("TEXT"); + + b.Property("SerializedWorkflowInstanceIds") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20241026094654_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20231015122159_Initial.cs similarity index 67% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20241026094654_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20231015122159_Initial.cs index aa0282a03a..d9ff77d6fe 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20241026094654_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20231015122159_Initial.cs @@ -1,21 +1,12 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) - { - _schema = schema; - } - /// protected override void Up(MigrationBuilder migrationBuilder) { @@ -26,12 +17,11 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "TEXT", nullable: false), PlanId = table.Column(type: "TEXT", nullable: false), WorkflowInstanceId = table.Column(type: "TEXT", nullable: false), - Status = table.Column(type: "TEXT", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - StartedAt = table.Column(type: "TEXT", nullable: true), - CompletedAt = table.Column(type: "TEXT", nullable: true), - SerializedLog = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + Status = table.Column(type: "INTEGER", nullable: false), + CreatedAt = table.Column(type: "TEXT", nullable: false), + StartedAt = table.Column(type: "TEXT", nullable: true), + CompletedAt = table.Column(type: "TEXT", nullable: true), + SerializedLog = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -43,13 +33,12 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "TEXT", nullable: false), - Status = table.Column(type: "TEXT", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - StartedAt = table.Column(type: "TEXT", nullable: true), - CompletedAt = table.Column(type: "TEXT", nullable: true), + Status = table.Column(type: "INTEGER", nullable: false), + CreatedAt = table.Column(type: "TEXT", nullable: false), + StartedAt = table.Column(type: "TEXT", nullable: true), + CompletedAt = table.Column(type: "TEXT", nullable: true), SerializedAlterations = table.Column(type: "TEXT", nullable: true), - SerializedWorkflowInstanceFilter = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + SerializedWorkflowInstanceIds = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -81,11 +70,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "AlterationJobs", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_AlterationJob_TenantId", - table: "AlterationJobs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_AlterationJob_WorkflowInstanceId", table: "AlterationJobs", @@ -110,11 +94,6 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_AlterationPlan_Status", table: "AlterationPlans", column: "Status"); - - migrationBuilder.CreateIndex( - name: "IX_AlterationPlan_TenantId", - table: "AlterationPlans", - column: "TenantId"); } /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240329200634_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240329200634_V3_1.Designer.cs new file mode 100644 index 0000000000..47bab0e42e --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240329200634_V3_1.Designer.cs @@ -0,0 +1,119 @@ +// +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240329200634_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.14"); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedLog") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedAlterations") + .HasColumnType("TEXT"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240329200634_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240329200634_V3_1.cs new file mode 100644 index 0000000000..c0aa49c2ca --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240329200634_V3_1.cs @@ -0,0 +1,68 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceIds", + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceFilter"); + + migrationBuilder.AlterColumn( + name: "Status", + table: "AlterationPlans", + type: "TEXT", + nullable: false, + oldClrType: typeof(int), + oldType: "INTEGER"); + + migrationBuilder.AlterColumn( + name: "Status", + table: "AlterationJobs", + type: "TEXT", + nullable: false, + oldClrType: typeof(int), + oldType: "INTEGER"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "SerializedWorkflowInstanceFilter", + table: "AlterationPlans", + newName: "SerializedWorkflowInstanceIds"); + + migrationBuilder.AlterColumn( + name: "Status", + table: "AlterationPlans", + type: "INTEGER", + nullable: false, + oldClrType: typeof(string), + oldType: "TEXT"); + + migrationBuilder.AlterColumn( + name: "Status", + table: "AlterationJobs", + type: "INTEGER", + nullable: false, + oldClrType: typeof(string), + oldType: "TEXT"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240610184608_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240610184608_V3_2.Designer.cs new file mode 100644 index 0000000000..74f9a7fa88 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240610184608_V3_2.Designer.cs @@ -0,0 +1,119 @@ +// +using Elsa.EntityFrameworkCore.Modules.Alterations; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations +{ + [DbContext(typeof(AlterationsElsaDbContext))] + [Migration("20240610184608_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.20"); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationJob", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedLog") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationJob_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationJob_CreatedAt"); + + b.HasIndex("PlanId") + .HasDatabaseName("IX_AlterationJob_PlanId"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationJob_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationJob_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId"); + + b.ToTable("AlterationJobs"); + }); + + modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedAlterations") + .HasColumnType("TEXT"); + + b.Property("SerializedWorkflowInstanceFilter") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_AlterationPlan_CompletedAt"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_AlterationPlan_CreatedAt"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_AlterationPlan_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_AlterationPlan_Status"); + + b.ToTable("AlterationPlans"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240610184608_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240610184608_V3_2.cs new file mode 100644 index 0000000000..f779303aa9 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240610184608_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20241026094654_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240715193134_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20241026094654_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240715193134_V3_3.Designer.cs index 44278d47f8..8eaf315df1 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20241026094654_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240715193134_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations { [DbContext(typeof(AlterationsElsaDbContext))] - [Migration("20241026094654_V3_3")] + [Migration("20240715193134_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240715193134_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240715193134_V3_3.cs new file mode 100644 index 0000000000..d6950f45c0 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Alterations/20240715193134_V3_3.cs @@ -0,0 +1,64 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Alterations +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + table: "AlterationPlans", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "AlterationJobs", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_AlterationPlan_TenantId", + table: "AlterationPlans", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AlterationJob_TenantId", + table: "AlterationJobs", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_AlterationPlan_TenantId", + table: "AlterationPlans"); + + migrationBuilder.DropIndex( + name: "IX_AlterationJob_TenantId", + table: "AlterationJobs"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "AlterationPlans"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "AlterationJobs"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20231015122246_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20231015122246_Initial.Designer.cs new file mode 100644 index 0000000000..e27d1ab1ed --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20231015122246_Initial.Designer.cs @@ -0,0 +1,125 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20231015122246_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.11"); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20241026094845_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20231015122246_Initial.cs similarity index 76% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20241026094845_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20231015122246_Initial.cs index 0e3dc81d5f..e78e031255 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20241026094845_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20231015122246_Initial.cs @@ -1,20 +1,12 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) - { - _schema = schema; - } - /// protected override void Up(MigrationBuilder migrationBuilder) { @@ -29,8 +21,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "TEXT", nullable: false), HashedApiKey = table.Column(type: "TEXT", nullable: false), HashedApiKeySalt = table.Column(type: "TEXT", nullable: false), - Roles = table.Column(type: "TEXT", nullable: false), - TenantId = table.Column(type: "TEXT", nullable: true) + Roles = table.Column(type: "TEXT", nullable: false) }, constraints: table => { @@ -43,8 +34,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), - Permissions = table.Column(type: "TEXT", nullable: false), - TenantId = table.Column(type: "TEXT", nullable: true) + Permissions = table.Column(type: "TEXT", nullable: false) }, constraints: table => { @@ -59,8 +49,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "TEXT", nullable: false), HashedPassword = table.Column(type: "TEXT", nullable: false), HashedPasswordSalt = table.Column(type: "TEXT", nullable: false), - Roles = table.Column(type: "TEXT", nullable: false), - TenantId = table.Column(type: "TEXT", nullable: true) + Roles = table.Column(type: "TEXT", nullable: false) }, constraints: table => { @@ -79,32 +68,17 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Application_TenantId", - table: "Applications", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_Role_Name", table: "Roles", column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_Role_TenantId", - table: "Roles", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_User_Name", table: "Users", column: "Name", unique: true); - - migrationBuilder.CreateIndex( - name: "IX_User_TenantId", - table: "Users", - column: "TenantId"); } /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240329200800_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240329200800_V3_1.Designer.cs new file mode 100644 index 0000000000..833c23e32d --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240329200800_V3_1.Designer.cs @@ -0,0 +1,125 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240329200800_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.14"); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240329200800_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240329200800_V3_1.cs new file mode 100644 index 0000000000..6e2aa0f3a1 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240329200800_V3_1.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240610184930_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240610184930_V3_2.Designer.cs new file mode 100644 index 0000000000..d94c085c81 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240610184930_V3_2.Designer.cs @@ -0,0 +1,125 @@ +// +using Elsa.EntityFrameworkCore.Modules.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity +{ + [DbContext(typeof(IdentityElsaDbContext))] + [Migration("20240610184930_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.20"); + + modelBuilder.Entity("Elsa.Identity.Entities.Application", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedApiKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedApiKeySalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedClientSecret") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedClientSecretSalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique() + .HasDatabaseName("IX_Application_ClientId"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Application_Name"); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.Role", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Permissions"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Role_Name"); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("Elsa.Identity.Entities.User", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("HashedPassword") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HashedPasswordSalt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("Roles"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_User_Name"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240610184930_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240610184930_V3_2.cs new file mode 100644 index 0000000000..3c43a28b7c --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240610184930_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20241026094845_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240715193539_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20241026094845_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240715193539_V3_3.Designer.cs index eac1f7613d..7afbb25bf8 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20241026094845_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240715193539_V3_3.Designer.cs @@ -10,7 +10,7 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity { [DbContext(typeof(IdentityElsaDbContext))] - [Migration("20241026094845_V3_3")] + [Migration("20240715193539_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240715193539_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240715193539_V3_3.cs new file mode 100644 index 0000000000..00c9983fc3 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Identity/20240715193539_V3_3.cs @@ -0,0 +1,83 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Identity +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + table: "Users", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "Roles", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "Applications", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_User_TenantId", + table: "Users", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Role_TenantId", + table: "Roles", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Application_TenantId", + table: "Applications", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_User_TenantId", + table: "Users"); + + migrationBuilder.DropIndex( + name: "IX_Role_TenantId", + table: "Roles"); + + migrationBuilder.DropIndex( + name: "IX_Application_TenantId", + table: "Applications"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "Users"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "Roles"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "Applications"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20231015122301_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20231015122301_Initial.Designer.cs new file mode 100644 index 0000000000..34b57767f2 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20231015122301_Initial.Designer.cs @@ -0,0 +1,79 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20231015122301_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.11"); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Color") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Labels"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20241026094913_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20231015122301_Initial.cs similarity index 77% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20241026094913_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20231015122301_Initial.cs index a73af89786..cffbc529e5 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20241026094913_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20231015122301_Initial.cs @@ -1,20 +1,12 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) - { - _schema = schema; - } - /// protected override void Up(MigrationBuilder migrationBuilder) { @@ -26,8 +18,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "TEXT", nullable: false), NormalizedName = table.Column(type: "TEXT", nullable: false), Description = table.Column(type: "TEXT", nullable: true), - Color = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + Color = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -41,8 +32,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "TEXT", nullable: false), WorkflowDefinitionId = table.Column(type: "TEXT", nullable: false), WorkflowDefinitionVersionId = table.Column(type: "TEXT", nullable: false), - LabelId = table.Column(type: "TEXT", nullable: false), - TenantId = table.Column(type: "TEXT", nullable: true) + LabelId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { @@ -54,11 +44,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitionLabels", column: "LabelId"); - migrationBuilder.CreateIndex( - name: "WorkflowDefinitionLabel_TenantId", - table: "WorkflowDefinitionLabels", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "WorkflowDefinitionLabel_WorkflowDefinitionId", table: "WorkflowDefinitionLabels", diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240329200834_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240329200834_V3_1.Designer.cs new file mode 100644 index 0000000000..0a36316d97 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240329200834_V3_1.Designer.cs @@ -0,0 +1,79 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240329200834_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.14"); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Color") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Labels"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240329200834_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240329200834_V3_1.cs new file mode 100644 index 0000000000..1f8f234efb --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240329200834_V3_1.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240610185018_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240610185018_V3_2.Designer.cs new file mode 100644 index 0000000000..45554fb6f5 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240610185018_V3_2.Designer.cs @@ -0,0 +1,79 @@ +// +using Elsa.EntityFrameworkCore.Modules.Labels; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels +{ + [DbContext(typeof(LabelsElsaDbContext))] + [Migration("20240610185018_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.20"); + + modelBuilder.Entity("Elsa.Labels.Entities.Label", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Color") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Labels"); + }); + + modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("LabelId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LabelId") + .HasDatabaseName("WorkflowDefinitionLabel_LabelId"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId"); + + b.ToTable("WorkflowDefinitionLabels"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240610185018_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240610185018_V3_2.cs new file mode 100644 index 0000000000..73bcf04f57 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240610185018_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20241026094913_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240715193657_V3_3.Designer.cs similarity index 98% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20241026094913_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240715193657_V3_3.Designer.cs index 04a8b8cab8..36f5cac52c 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20241026094913_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240715193657_V3_3.Designer.cs @@ -10,7 +10,7 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels { [DbContext(typeof(LabelsElsaDbContext))] - [Migration("20241026094913_V3_3")] + [Migration("20240715193657_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240715193657_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240715193657_V3_3.cs new file mode 100644 index 0000000000..792c0c6f13 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Labels/20240715193657_V3_3.cs @@ -0,0 +1,55 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Labels +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + table: "WorkflowDefinitionLabels", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "Labels", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateIndex( + name: "WorkflowDefinitionLabel_TenantId", + table: "WorkflowDefinitionLabels", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "WorkflowDefinitionLabel_TenantId", + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "WorkflowDefinitionLabels"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "Labels"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20231015122231_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20231015122231_Initial.Designer.cs new file mode 100644 index 0000000000..41c6a5ceb8 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20231015122231_Initial.Designer.cs @@ -0,0 +1,193 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20231015122231_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.11"); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("BinaryData") + .HasColumnType("BLOB"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("IsLatest") + .HasColumnType("INTEGER"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("IsReadonly") + .HasColumnType("INTEGER"); + + b.Property("MaterializerContext") + .HasColumnType("TEXT"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasColumnType("TEXT"); + + b.Property("StringData") + .HasColumnType("TEXT"); + + b.Property("ToolVersion") + .HasColumnType("TEXT"); + + b.Property("UsableAsActivity") + .HasColumnType("INTEGER"); + + b.Property("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FinishedAt") + .HasColumnType("TEXT"); + + b.Property("IncidentCount") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20241026094800_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20231015122231_Initial.cs similarity index 78% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20241026094800_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20231015122231_Initial.cs index 2567885128..da07029d06 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20241026094800_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20231015122231_Initial.cs @@ -1,21 +1,12 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) - { - _schema = schema; - } - /// protected override void Up(MigrationBuilder migrationBuilder) { @@ -34,11 +25,9 @@ protected override void Up(MigrationBuilder migrationBuilder) StringData = table.Column(type: "TEXT", nullable: true), BinaryData = table.Column(type: "BLOB", nullable: true), IsReadonly = table.Column(type: "INTEGER", nullable: false), - IsSystem = table.Column(type: "INTEGER", nullable: false), Data = table.Column(type: "TEXT", nullable: true), UsableAsActivity = table.Column(type: "INTEGER", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), + CreatedAt = table.Column(type: "TEXT", nullable: false), Version = table.Column(type: "INTEGER", nullable: false), IsLatest = table.Column(type: "INTEGER", nullable: false), IsPublished = table.Column(type: "INTEGER", nullable: false) @@ -56,19 +45,15 @@ protected override void Up(MigrationBuilder migrationBuilder) DefinitionId = table.Column(type: "TEXT", nullable: false), DefinitionVersionId = table.Column(type: "TEXT", nullable: false), Version = table.Column(type: "INTEGER", nullable: false), - ParentWorkflowInstanceId = table.Column(type: "TEXT", nullable: true), Status = table.Column(type: "TEXT", nullable: false), SubStatus = table.Column(type: "TEXT", nullable: false), CorrelationId = table.Column(type: "TEXT", nullable: true), Name = table.Column(type: "TEXT", nullable: true), IncidentCount = table.Column(type: "INTEGER", nullable: false), - IsSystem = table.Column(type: "INTEGER", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false), - FinishedAt = table.Column(type: "TEXT", nullable: true), - Data = table.Column(type: "TEXT", nullable: true), - DataCompressionAlgorithm = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + CreatedAt = table.Column(type: "TEXT", nullable: false), + UpdatedAt = table.Column(type: "TEXT", nullable: false), + FinishedAt = table.Column(type: "TEXT", nullable: true), + Data = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -91,21 +76,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowDefinitions", column: "IsPublished"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_IsSystem", - table: "WorkflowDefinitions", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_Name", table: "WorkflowDefinitions", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowDefinition_TenantId", - table: "WorkflowDefinitions", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowDefinition_UsableAsActivity", table: "WorkflowDefinitions", @@ -136,11 +111,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowInstances", column: "FinishedAt"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_IsSystem", - table: "WorkflowInstances", - column: "IsSystem"); - migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_Name", table: "WorkflowInstances", @@ -176,11 +146,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowInstances", columns: new[] { "SubStatus", "DefinitionId" }); - migrationBuilder.CreateIndex( - name: "IX_WorkflowInstance_TenantId", - table: "WorkflowInstances", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowInstance_UpdatedAt", table: "WorkflowInstances", diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240329200734_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240329200734_V3_1.Designer.cs new file mode 100644 index 0000000000..9cc7d53bcc --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240329200734_V3_1.Designer.cs @@ -0,0 +1,211 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240329200734_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.14"); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("BinaryData") + .HasColumnType("BLOB"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("IsLatest") + .HasColumnType("INTEGER"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("IsReadonly") + .HasColumnType("INTEGER"); + + b.Property("IsSystem") + .HasColumnType("INTEGER"); + + b.Property("MaterializerContext") + .HasColumnType("TEXT"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasColumnType("TEXT"); + + b.Property("StringData") + .HasColumnType("TEXT"); + + b.Property("ToolVersion") + .HasColumnType("TEXT"); + + b.Property("UsableAsActivity") + .HasColumnType("INTEGER"); + + b.Property("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("TEXT"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FinishedAt") + .HasColumnType("TEXT"); + + b.Property("IncidentCount") + .HasColumnType("INTEGER"); + + b.Property("IsSystem") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240329200734_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240329200734_V3_1.cs new file mode 100644 index 0000000000..deaad852f5 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240329200734_V3_1.cs @@ -0,0 +1,86 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DataCompressionAlgorithm", + table: "WorkflowInstances", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSystem", + table: "WorkflowInstances", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ParentWorkflowInstanceId", + table: "WorkflowInstances", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSystem", + table: "WorkflowDefinitions", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_IsSystem", + table: "WorkflowInstances", + column: "IsSystem"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_IsSystem", + table: "WorkflowDefinitions", + column: "IsSystem"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_IsSystem", + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_IsSystem", + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "DataCompressionAlgorithm", + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "ParentWorkflowInstanceId", + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "IsSystem", + table: "WorkflowDefinitions"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240610184829_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240610184829_V3_2.Designer.cs new file mode 100644 index 0000000000..e04c4c939c --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240610184829_V3_2.Designer.cs @@ -0,0 +1,211 @@ +// +using System; +using Elsa.EntityFrameworkCore.Modules.Management; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management +{ + [DbContext(typeof(ManagementElsaDbContext))] + [Migration("20240610184829_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.20"); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("BinaryData") + .HasColumnType("BLOB"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("IsLatest") + .HasColumnType("INTEGER"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("IsReadonly") + .HasColumnType("INTEGER"); + + b.Property("IsSystem") + .HasColumnType("INTEGER"); + + b.Property("MaterializerContext") + .HasColumnType("TEXT"); + + b.Property("MaterializerName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasColumnType("TEXT"); + + b.Property("StringData") + .HasColumnType("TEXT"); + + b.Property("ToolVersion") + .HasColumnType("TEXT"); + + b.Property("UsableAsActivity") + .HasColumnType("INTEGER"); + + b.Property("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("IsLatest") + .HasDatabaseName("IX_WorkflowDefinition_IsLatest"); + + b.HasIndex("IsPublished") + .HasDatabaseName("IX_WorkflowDefinition_IsPublished"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowDefinition_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowDefinition_Name"); + + b.HasIndex("UsableAsActivity") + .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity"); + + b.HasIndex("Version") + .HasDatabaseName("IX_WorkflowDefinition_Version"); + + b.HasIndex("DefinitionId", "Version") + .IsUnique() + .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version"); + + b.ToTable("WorkflowDefinitions"); + }); + + modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("DataCompressionAlgorithm") + .HasColumnType("TEXT"); + + b.Property("DefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("DefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FinishedAt") + .HasColumnType("TEXT"); + + b.Property("IncidentCount") + .HasColumnType("INTEGER"); + + b.Property("IsSystem") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentWorkflowInstanceId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SubStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationId") + .HasDatabaseName("IX_WorkflowInstance_CorrelationId"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_WorkflowInstance_CreatedAt"); + + b.HasIndex("DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_DefinitionId"); + + b.HasIndex("FinishedAt") + .HasDatabaseName("IX_WorkflowInstance_FinishedAt"); + + b.HasIndex("IsSystem") + .HasDatabaseName("IX_WorkflowInstance_IsSystem"); + + b.HasIndex("Name") + .HasDatabaseName("IX_WorkflowInstance_Name"); + + b.HasIndex("Status") + .HasDatabaseName("IX_WorkflowInstance_Status"); + + b.HasIndex("SubStatus") + .HasDatabaseName("IX_WorkflowInstance_SubStatus"); + + b.HasIndex("UpdatedAt") + .HasDatabaseName("IX_WorkflowInstance_UpdatedAt"); + + b.HasIndex("Status", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId"); + + b.HasIndex("Status", "SubStatus") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus"); + + b.HasIndex("SubStatus", "DefinitionId") + .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId"); + + b.HasIndex("Status", "SubStatus", "DefinitionId", "Version") + .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version"); + + b.ToTable("WorkflowInstances"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240610184829_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240610184829_V3_2.cs new file mode 100644 index 0000000000..003ae489f9 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240610184829_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20241026094800_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240715193420_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20241026094800_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240715193420_V3_3.Designer.cs index 586b5755d7..e4b881b0c1 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20241026094800_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240715193420_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management { [DbContext(typeof(ManagementElsaDbContext))] - [Migration("20241026094800_V3_3")] + [Migration("20240715193420_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240715193420_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240715193420_V3_3.cs new file mode 100644 index 0000000000..b90a4d8857 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Management/20240715193420_V3_3.cs @@ -0,0 +1,64 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Management +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TenantId", + table: "WorkflowInstances", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "WorkflowDefinitions", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInstance_TenantId", + table: "WorkflowInstances", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowDefinition_TenantId", + table: "WorkflowDefinitions", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_WorkflowInstance_TenantId", + table: "WorkflowInstances"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowDefinition_TenantId", + table: "WorkflowDefinitions"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "WorkflowInstances"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "WorkflowDefinitions"); + } + } +} \ No newline at end of file diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20231024160948_Initial.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20231024160948_Initial.Designer.cs new file mode 100644 index 0000000000..3d44652209 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20231024160948_Initial.Designer.cs @@ -0,0 +1,386 @@ +// +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20231024160948_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.11"); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityName") + .HasColumnType("TEXT"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityTypeVersion") + .HasColumnType("INTEGER"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("HasBookmarks") + .HasColumnType("INTEGER"); + + b.Property("SerializedActivityState") + .HasColumnType("TEXT"); + + b.Property("SerializedException") + .HasColumnType("TEXT"); + + b.Property("SerializedOutputs") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedMetadata") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityName") + .HasColumnType("TEXT"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityTypeVersion") + .HasColumnType("INTEGER"); + + b.Property("EventName") + .HasColumnType("TEXT"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("Sequence") + .HasColumnType("INTEGER"); + + b.Property("SerializedActivityState") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("Source") + .HasColumnType("TEXT"); + + b.Property("Timestamp") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowVersion") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("TEXT"); + + b.Property("SerializedInput") + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20241026094730_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20231024160948_Initial.cs similarity index 76% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20241026094730_V3_3.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20231024160948_Initial.cs index 728ddc0fca..d8f72fb2bf 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20241026094730_V3_3.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20231024160948_Initial.cs @@ -1,21 +1,12 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime { /// - public partial class V3_3 : Migration + public partial class Initial : Migration { - private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema; - - /// - public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema) - { - _schema = schema; - } - /// protected override void Up(MigrationBuilder migrationBuilder) { @@ -30,74 +21,37 @@ protected override void Up(MigrationBuilder migrationBuilder) ActivityType = table.Column(type: "TEXT", nullable: false), ActivityTypeVersion = table.Column(type: "INTEGER", nullable: false), ActivityName = table.Column(type: "TEXT", nullable: true), - StartedAt = table.Column(type: "TEXT", nullable: false), + StartedAt = table.Column(type: "TEXT", nullable: false), HasBookmarks = table.Column(type: "INTEGER", nullable: false), Status = table.Column(type: "TEXT", nullable: false), - CompletedAt = table.Column(type: "TEXT", nullable: true), + CompletedAt = table.Column(type: "TEXT", nullable: true), SerializedActivityState = table.Column(type: "TEXT", nullable: true), - SerializedActivityStateCompressionAlgorithm = table.Column(type: "TEXT", nullable: true), SerializedException = table.Column(type: "TEXT", nullable: true), SerializedOutputs = table.Column(type: "TEXT", nullable: true), - SerializedPayload = table.Column(type: "TEXT", nullable: true), - SerializedProperties = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + SerializedPayload = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ActivityExecutionRecords", x => x.Id); }); - migrationBuilder.CreateTable( - name: "BookmarkQueueItems", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - WorkflowInstanceId = table.Column(type: "TEXT", nullable: true), - CorrelationId = table.Column(type: "TEXT", nullable: true), - BookmarkId = table.Column(type: "TEXT", nullable: true), - StimulusHash = table.Column(type: "TEXT", nullable: true), - ActivityInstanceId = table.Column(type: "TEXT", nullable: true), - ActivityTypeName = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), - SerializedOptions = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); - }); - migrationBuilder.CreateTable( name: "Bookmarks", columns: table => new { - Id = table.Column(type: "TEXT", nullable: false), + BookmarkId = table.Column(type: "TEXT", nullable: false), ActivityTypeName = table.Column(type: "TEXT", nullable: false), Hash = table.Column(type: "TEXT", nullable: false), WorkflowInstanceId = table.Column(type: "TEXT", nullable: false), ActivityInstanceId = table.Column(type: "TEXT", nullable: true), CorrelationId = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), + CreatedAt = table.Column(type: "TEXT", nullable: false), SerializedMetadata = table.Column(type: "TEXT", nullable: true), - SerializedPayload = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + SerializedPayload = table.Column(type: "TEXT", nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Bookmarks", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "KeyValuePairs", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - SerializedValue = table.Column(type: "TEXT", nullable: false), - TenantId = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_KeyValuePairs", x => x.Id); + table.PrimaryKey("PK_Bookmarks", x => x.BookmarkId); }); migrationBuilder.CreateTable( @@ -110,8 +64,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Name = table.Column(type: "TEXT", nullable: false), ActivityId = table.Column(type: "TEXT", nullable: false), Hash = table.Column(type: "TEXT", nullable: true), - SerializedPayload = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + SerializedPayload = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -134,20 +87,39 @@ protected override void Up(MigrationBuilder migrationBuilder) ActivityTypeVersion = table.Column(type: "INTEGER", nullable: false), ActivityName = table.Column(type: "TEXT", nullable: true), ActivityNodeId = table.Column(type: "TEXT", nullable: false), - Timestamp = table.Column(type: "TEXT", nullable: false), + Timestamp = table.Column(type: "TEXT", nullable: false), Sequence = table.Column(type: "INTEGER", nullable: false), EventName = table.Column(type: "TEXT", nullable: true), Message = table.Column(type: "TEXT", nullable: true), Source = table.Column(type: "TEXT", nullable: true), SerializedActivityState = table.Column(type: "TEXT", nullable: true), - SerializedPayload = table.Column(type: "TEXT", nullable: true), - TenantId = table.Column(type: "TEXT", nullable: true) + SerializedPayload = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_WorkflowExecutionLogRecords", x => x.Id); }); + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + ActivityTypeName = table.Column(type: "TEXT", nullable: false), + Hash = table.Column(type: "TEXT", nullable: false), + WorkflowInstanceId = table.Column(type: "TEXT", nullable: true), + CorrelationId = table.Column(type: "TEXT", nullable: true), + ActivityInstanceId = table.Column(type: "TEXT", nullable: true), + CreatedAt = table.Column(type: "TEXT", nullable: false), + ExpiresAt = table.Column(type: "TEXT", nullable: false), + SerializedBookmarkPayload = table.Column(type: "TEXT", nullable: true), + SerializedInput = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }); + migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_ActivityId", table: "ActivityExecutionRecords", @@ -198,56 +170,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "ActivityExecutionRecords", column: "Status"); - migrationBuilder.CreateIndex( - name: "IX_ActivityExecutionRecord_TenantId", - table: "ActivityExecutionRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_ActivityExecutionRecord_WorkflowInstanceId", table: "ActivityExecutionRecords", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityInstanceId", - table: "BookmarkQueueItems", - column: "ActivityInstanceId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_ActivityTypeName", - table: "BookmarkQueueItems", - column: "ActivityTypeName"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_BookmarkId", - table: "BookmarkQueueItems", - column: "BookmarkId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CorrelationId", - table: "BookmarkQueueItems", - column: "CorrelationId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_CreatedAt", - table: "BookmarkQueueItems", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_StimulusHash", - table: "BookmarkQueueItems", - column: "StimulusHash"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_TenantId", - table: "BookmarkQueueItems", - column: "TenantId"); - - migrationBuilder.CreateIndex( - name: "IX_BookmarkQueueItem_WorkflowInstanceId", - table: "BookmarkQueueItems", - column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_ActivityInstanceId", table: "Bookmarks", @@ -278,21 +205,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Bookmarks", column: "Hash"); - migrationBuilder.CreateIndex( - name: "IX_StoredBookmark_TenantId", - table: "Bookmarks", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredBookmark_WorkflowInstanceId", table: "Bookmarks", column: "WorkflowInstanceId"); - migrationBuilder.CreateIndex( - name: "IX_SerializedKeyValuePair_TenantId", - table: "KeyValuePairs", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_Hash", table: "Triggers", @@ -303,11 +220,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Triggers", column: "Name"); - migrationBuilder.CreateIndex( - name: "IX_StoredTrigger_TenantId", - table: "Triggers", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_StoredTrigger_WorkflowDefinitionId", table: "Triggers", @@ -368,11 +280,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "WorkflowExecutionLogRecords", column: "Sequence"); - migrationBuilder.CreateIndex( - name: "IX_WorkflowExecutionLogRecord_TenantId", - table: "WorkflowExecutionLogRecords", - column: "TenantId"); - migrationBuilder.CreateIndex( name: "IX_WorkflowExecutionLogRecord_Timestamp", table: "WorkflowExecutionLogRecords", @@ -402,6 +309,41 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_WorkflowExecutionLogRecord_WorkflowVersion", table: "WorkflowExecutionLogRecords", column: "WorkflowVersion"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); } /// @@ -410,20 +352,17 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "ActivityExecutionRecords"); - migrationBuilder.DropTable( - name: "BookmarkQueueItems"); - migrationBuilder.DropTable( name: "Bookmarks"); - migrationBuilder.DropTable( - name: "KeyValuePairs"); - migrationBuilder.DropTable( name: "Triggers"); migrationBuilder.DropTable( name: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropTable( + name: "WorkflowInboxMessages"); } } } diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240329200705_V3_1.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240329200705_V3_1.Designer.cs new file mode 100644 index 0000000000..a101dd2993 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240329200705_V3_1.Designer.cs @@ -0,0 +1,406 @@ +// +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240329200705_V3_1")] + partial class V3_1 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.14"); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("TEXT"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityName") + .HasColumnType("TEXT"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityTypeVersion") + .HasColumnType("INTEGER"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("HasBookmarks") + .HasColumnType("INTEGER"); + + b.Property("SerializedActivityState") + .HasColumnType("TEXT"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("TEXT"); + + b.Property("SerializedException") + .HasColumnType("TEXT"); + + b.Property("SerializedOutputs") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("SerializedProperties") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedMetadata") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityName") + .HasColumnType("TEXT"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityTypeVersion") + .HasColumnType("INTEGER"); + + b.Property("EventName") + .HasColumnType("TEXT"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("Sequence") + .HasColumnType("INTEGER"); + + b.Property("SerializedActivityState") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("Source") + .HasColumnType("TEXT"); + + b.Property("Timestamp") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowVersion") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("TEXT"); + + b.Property("SerializedInput") + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240329200705_V3_1.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240329200705_V3_1.cs new file mode 100644 index 0000000000..ddea13893b --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240329200705_V3_1.cs @@ -0,0 +1,61 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime +{ + /// + public partial class V3_1 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_1(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SerializedActivityStateCompressionAlgorithm", + table: "ActivityExecutionRecords", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "SerializedProperties", + table: "ActivityExecutionRecords", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateTable( + name: "KeyValuePairs", + columns: table => new + { + Key = table.Column(type: "TEXT", nullable: false), + SerializedValue = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_KeyValuePairs", x => x.Key); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "KeyValuePairs"); + + migrationBuilder.DropColumn( + name: "SerializedActivityStateCompressionAlgorithm", + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "SerializedProperties", + table: "ActivityExecutionRecords"); + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240610184731_V3_2.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240610184731_V3_2.Designer.cs new file mode 100644 index 0000000000..1408fee545 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240610184731_V3_2.Designer.cs @@ -0,0 +1,406 @@ +// +using Elsa.EntityFrameworkCore.Modules.Runtime; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime +{ + [DbContext(typeof(RuntimeElsaDbContext))] + [Migration("20240610184731_V3_2")] + partial class V3_2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.20"); + + modelBuilder.Entity("Elsa.KeyValues.Entities.SerializedKeyValuePair", b => + { + b.Property("Key") + .HasColumnType("TEXT"); + + b.Property("SerializedValue") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Key"); + + b.ToTable("KeyValuePairs"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.ActivityExecutionRecord", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityName") + .HasColumnType("TEXT"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityTypeVersion") + .HasColumnType("INTEGER"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("HasBookmarks") + .HasColumnType("INTEGER"); + + b.Property("SerializedActivityState") + .HasColumnType("TEXT"); + + b.Property("SerializedActivityStateCompressionAlgorithm") + .HasColumnType("TEXT"); + + b.Property("SerializedException") + .HasColumnType("TEXT"); + + b.Property("SerializedOutputs") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("SerializedProperties") + .HasColumnType("TEXT"); + + b.Property("StartedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityTypeVersion"); + + b.HasIndex("CompletedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_CompletedAt"); + + b.HasIndex("HasBookmarks") + .HasDatabaseName("IX_ActivityExecutionRecord_HasBookmarks"); + + b.HasIndex("StartedAt") + .HasDatabaseName("IX_ActivityExecutionRecord_StartedAt"); + + b.HasIndex("Status") + .HasDatabaseName("IX_ActivityExecutionRecord_Status"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_ActivityExecutionRecord_WorkflowInstanceId"); + + b.HasIndex("ActivityType", "ActivityTypeVersion") + .HasDatabaseName("IX_ActivityExecutionRecord_ActivityType_ActivityTypeVersion"); + + b.ToTable("ActivityExecutionRecords"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredBookmark", b => + { + b.Property("BookmarkId") + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedMetadata") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("BookmarkId"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_StoredBookmark_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_StoredBookmark_ActivityTypeName"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash" }, "IX_StoredBookmark_ActivityTypeName_Hash"); + + b.HasIndex(new[] { "ActivityTypeName", "Hash", "WorkflowInstanceId" }, "IX_StoredBookmark_ActivityTypeName_Hash_WorkflowInstanceId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_StoredBookmark_CreatedAt"); + + b.HasIndex(new[] { "Hash" }, "IX_StoredBookmark_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_StoredBookmark_WorkflowInstanceId"); + + b.ToTable("Bookmarks"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.StoredTrigger", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Hash") + .HasDatabaseName("IX_StoredTrigger_Hash"); + + b.HasIndex("Name") + .HasDatabaseName("IX_StoredTrigger_Name"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_StoredTrigger_WorkflowDefinitionVersionId"); + + b.ToTable("Triggers"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowExecutionLogRecord", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityName") + .HasColumnType("TEXT"); + + b.Property("ActivityNodeId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ActivityTypeVersion") + .HasColumnType("INTEGER"); + + b.Property("EventName") + .HasColumnType("TEXT"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("ParentActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("Sequence") + .HasColumnType("INTEGER"); + + b.Property("SerializedActivityState") + .HasColumnType("TEXT"); + + b.Property("SerializedPayload") + .HasColumnType("TEXT"); + + b.Property("Source") + .HasColumnType("TEXT"); + + b.Property("Timestamp") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowDefinitionVersionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WorkflowVersion") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityId"); + + b.HasIndex("ActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityInstanceId"); + + b.HasIndex("ActivityName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityName"); + + b.HasIndex("ActivityNodeId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityNodeId"); + + b.HasIndex("ActivityType") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityType"); + + b.HasIndex("ActivityTypeVersion") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ActivityTypeVersion"); + + b.HasIndex("EventName") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_EventName"); + + b.HasIndex("ParentActivityInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_ParentActivityInstanceId"); + + b.HasIndex("Sequence") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Sequence"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_Timestamp"); + + b.HasIndex("WorkflowDefinitionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionId"); + + b.HasIndex("WorkflowDefinitionVersionId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowDefinitionVersionId"); + + b.HasIndex("WorkflowInstanceId") + .HasDatabaseName("IX_WorkflowExecutionLogRecord_WorkflowInstanceId"); + + 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"); + + b.ToTable("WorkflowExecutionLogRecords"); + }); + + modelBuilder.Entity("Elsa.Workflows.Runtime.Entities.WorkflowInboxMessage", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActivityInstanceId") + .HasColumnType("TEXT"); + + b.Property("ActivityTypeName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CorrelationId") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SerializedBookmarkPayload") + .HasColumnType("TEXT"); + + b.Property("SerializedInput") + .HasColumnType("TEXT"); + + b.Property("WorkflowInstanceId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "ActivityInstanceId" }, "IX_WorkflowInboxMessage_ActivityInstanceId"); + + b.HasIndex(new[] { "ActivityTypeName" }, "IX_WorkflowInboxMessage_ActivityTypeName"); + + b.HasIndex(new[] { "CorrelationId" }, "IX_WorkflowInboxMessage_CorrelationId"); + + b.HasIndex(new[] { "CreatedAt" }, "IX_WorkflowInboxMessage_CreatedAt"); + + b.HasIndex(new[] { "ExpiresAt" }, "IX_WorkflowInboxMessage_ExpiresAt"); + + b.HasIndex(new[] { "Hash" }, "IX_WorkflowInboxMessage_Hash"); + + b.HasIndex(new[] { "WorkflowInstanceId" }, "IX_WorkflowInboxMessage_WorkflowInstanceId"); + + b.ToTable("WorkflowInboxMessages"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240610184731_V3_2.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240610184731_V3_2.cs new file mode 100644 index 0000000000..af8aed20a9 --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240610184731_V3_2.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime +{ + /// + public partial class V3_2 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_2(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20241026094730_V3_3.Designer.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240715193310_V3_3.Designer.cs similarity index 99% rename from src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20241026094730_V3_3.Designer.cs rename to src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240715193310_V3_3.Designer.cs index c82b6ecd41..07205316a6 100644 --- a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20241026094730_V3_3.Designer.cs +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240715193310_V3_3.Designer.cs @@ -11,7 +11,7 @@ namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime { [DbContext(typeof(RuntimeElsaDbContext))] - [Migration("20241026094730_V3_3")] + [Migration("20240715193310_V3_3")] partial class V3_3 { /// diff --git a/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240715193310_V3_3.cs b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240715193310_V3_3.cs new file mode 100644 index 0000000000..519db98e2c --- /dev/null +++ b/src/modules/Elsa.EntityFrameworkCore.Sqlite/Migrations/Runtime/20240715193310_V3_3.cs @@ -0,0 +1,262 @@ +#nullable disable + +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Elsa.EntityFrameworkCore.Sqlite.Migrations.Runtime +{ + /// + public partial class V3_3 : Migration + { + private readonly IElsaDbContextSchema _schema; + + /// + public V3_3(IElsaDbContextSchema schema) + { + _schema = schema; + } + + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WorkflowInboxMessages"); + + migrationBuilder.RenameColumn( + name: "Key", + table: "KeyValuePairs", + newName: "Id"); + + migrationBuilder.RenameColumn( + name: "BookmarkId", + table: "Bookmarks", + newName: "Id"); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "WorkflowExecutionLogRecords", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "Triggers", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "KeyValuePairs", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "Bookmarks", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "ActivityExecutionRecords", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateTable( + name: "BookmarkQueueItems", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + WorkflowInstanceId = table.Column(type: "TEXT", nullable: true), + CorrelationId = table.Column(type: "TEXT", nullable: true), + BookmarkId = table.Column(type: "TEXT", nullable: true), + StimulusHash = table.Column(type: "TEXT", nullable: true), + ActivityInstanceId = table.Column(type: "TEXT", nullable: true), + ActivityTypeName = table.Column(type: "TEXT", nullable: true), + CreatedAt = table.Column(type: "TEXT", nullable: false), + SerializedOptions = table.Column(type: "TEXT", nullable: true), + TenantId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BookmarkQueueItems", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + table: "WorkflowExecutionLogRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredTrigger_TenantId", + table: "Triggers", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_SerializedKeyValuePair_TenantId", + table: "KeyValuePairs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_StoredBookmark_TenantId", + table: "Bookmarks", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityExecutionRecord_TenantId", + table: "ActivityExecutionRecords", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityInstanceId", + table: "BookmarkQueueItems", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_ActivityTypeName", + table: "BookmarkQueueItems", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_BookmarkId", + table: "BookmarkQueueItems", + column: "BookmarkId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CorrelationId", + table: "BookmarkQueueItems", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_CreatedAt", + table: "BookmarkQueueItems", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_StimulusHash", + table: "BookmarkQueueItems", + column: "StimulusHash"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_TenantId", + table: "BookmarkQueueItems", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_BookmarkQueueItem_WorkflowInstanceId", + table: "BookmarkQueueItems", + column: "WorkflowInstanceId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BookmarkQueueItems"); + + migrationBuilder.DropIndex( + name: "IX_WorkflowExecutionLogRecord_TenantId", + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropIndex( + name: "IX_StoredTrigger_TenantId", + table: "Triggers"); + + migrationBuilder.DropIndex( + name: "IX_SerializedKeyValuePair_TenantId", + table: "KeyValuePairs"); + + migrationBuilder.DropIndex( + name: "IX_StoredBookmark_TenantId", + table: "Bookmarks"); + + migrationBuilder.DropIndex( + name: "IX_ActivityExecutionRecord_TenantId", + table: "ActivityExecutionRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "WorkflowExecutionLogRecords"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "Triggers"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "KeyValuePairs"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "Bookmarks"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "ActivityExecutionRecords"); + + migrationBuilder.RenameColumn( + name: "Id", + table: "KeyValuePairs", + newName: "Key"); + + migrationBuilder.RenameColumn( + name: "Id", + table: "Bookmarks", + newName: "BookmarkId"); + + migrationBuilder.CreateTable( + name: "WorkflowInboxMessages", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + ActivityInstanceId = table.Column(type: "TEXT", nullable: true), + ActivityTypeName = table.Column(type: "TEXT", nullable: false), + CorrelationId = table.Column(type: "TEXT", nullable: true), + CreatedAt = table.Column(type: "TEXT", nullable: false), + ExpiresAt = table.Column(type: "TEXT", nullable: false), + Hash = table.Column(type: "TEXT", nullable: false), + SerializedBookmarkPayload = table.Column(type: "TEXT", nullable: true), + SerializedInput = table.Column(type: "TEXT", nullable: true), + WorkflowInstanceId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkflowInboxMessages", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityInstanceId", + table: "WorkflowInboxMessages", + column: "ActivityInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ActivityTypeName", + table: "WorkflowInboxMessages", + column: "ActivityTypeName"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CorrelationId", + table: "WorkflowInboxMessages", + column: "CorrelationId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_CreatedAt", + table: "WorkflowInboxMessages", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_ExpiresAt", + table: "WorkflowInboxMessages", + column: "ExpiresAt"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_Hash", + table: "WorkflowInboxMessages", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_WorkflowInboxMessage_WorkflowInstanceId", + table: "WorkflowInboxMessages", + column: "WorkflowInstanceId"); + } + } +} \ No newline at end of file