< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 323
Coverable lines: 323
Total lines: 392
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: .ctor(...)0%620%
File 1: Up(...)100%210%
File 1: Down(...)100%210%
File 2: BuildTargetModel(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.PostgreSql/Migrations/Management/20231015122234_Initial.cs

#LineLine coverage
 1
 2using Microsoft.EntityFrameworkCore.Migrations;
 3
 4#nullable disable
 5
 6namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Management
 7{
 8    /// <inheritdoc />
 9    public partial class Initial : Migration
 10    {
 11        private readonly IElsaDbContextSchema _schema;
 012        public Initial(IElsaDbContextSchema schema)
 13        {
 014            _schema = schema ?? throw new ArgumentNullException(nameof(schema));
 015        }
 16        /// <inheritdoc />
 17        protected override void Up(MigrationBuilder migrationBuilder)
 18        {
 019            migrationBuilder.EnsureSchema(
 020                name: _schema.Schema);
 21
 022            migrationBuilder.CreateTable(
 023                name: "WorkflowDefinitions",
 024                schema: _schema.Schema,
 025                columns: table => new
 026                {
 027                    Id = table.Column<string>(type: "text", nullable: false),
 028                    DefinitionId = table.Column<string>(type: "text", nullable: false),
 029                    Name = table.Column<string>(type: "text", nullable: true),
 030                    Description = table.Column<string>(type: "text", nullable: true),
 031                    ToolVersion = table.Column<string>(type: "text", nullable: true),
 032                    ProviderName = table.Column<string>(type: "text", nullable: true),
 033                    MaterializerName = table.Column<string>(type: "text", nullable: false),
 034                    MaterializerContext = table.Column<string>(type: "text", nullable: true),
 035                    StringData = table.Column<string>(type: "text", nullable: true),
 036                    BinaryData = table.Column<byte[]>(type: "bytea", nullable: true),
 037                    IsReadonly = table.Column<bool>(type: "boolean", nullable: false),
 038                    Data = table.Column<string>(type: "text", nullable: true),
 039                    UsableAsActivity = table.Column<bool>(type: "boolean", nullable: true),
 040                    CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 041                    Version = table.Column<int>(type: "integer", nullable: false),
 042                    IsLatest = table.Column<bool>(type: "boolean", nullable: false),
 043                    IsPublished = table.Column<bool>(type: "boolean", nullable: false)
 044                },
 045                constraints: table =>
 046                {
 047                    table.PrimaryKey("PK_WorkflowDefinitions", x => x.Id);
 048                });
 49
 050            migrationBuilder.CreateTable(
 051                name: "WorkflowInstances",
 052                schema: _schema.Schema,
 053                columns: table => new
 054                {
 055                    Id = table.Column<string>(type: "text", nullable: false),
 056                    DefinitionId = table.Column<string>(type: "text", nullable: false),
 057                    DefinitionVersionId = table.Column<string>(type: "text", nullable: false),
 058                    Version = table.Column<int>(type: "integer", nullable: false),
 059                    Status = table.Column<string>(type: "text", nullable: false),
 060                    SubStatus = table.Column<string>(type: "text", nullable: false),
 061                    CorrelationId = table.Column<string>(type: "text", nullable: true),
 062                    Name = table.Column<string>(type: "text", nullable: true),
 063                    IncidentCount = table.Column<int>(type: "integer", nullable: false),
 064                    CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 065                    UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 066                    FinishedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
 067                    Data = table.Column<string>(type: "text", nullable: true)
 068                },
 069                constraints: table =>
 070                {
 071                    table.PrimaryKey("PK_WorkflowInstances", x => x.Id);
 072                });
 73
 074            migrationBuilder.CreateIndex(
 075                name: "IX_WorkflowDefinition_DefinitionId_Version",
 076                schema: _schema.Schema,
 077                table: "WorkflowDefinitions",
 078                columns: new[] { "DefinitionId", "Version" },
 079                unique: true);
 80
 081            migrationBuilder.CreateIndex(
 082                name: "IX_WorkflowDefinition_IsLatest",
 083                schema: _schema.Schema,
 084                table: "WorkflowDefinitions",
 085                column: "IsLatest");
 86
 087            migrationBuilder.CreateIndex(
 088                name: "IX_WorkflowDefinition_IsPublished",
 089                schema: _schema.Schema,
 090                table: "WorkflowDefinitions",
 091                column: "IsPublished");
 92
 093            migrationBuilder.CreateIndex(
 094                name: "IX_WorkflowDefinition_Name",
 095                schema: _schema.Schema,
 096                table: "WorkflowDefinitions",
 097                column: "Name");
 98
 099            migrationBuilder.CreateIndex(
 0100                name: "IX_WorkflowDefinition_UsableAsActivity",
 0101                schema: _schema.Schema,
 0102                table: "WorkflowDefinitions",
 0103                column: "UsableAsActivity");
 104
 0105            migrationBuilder.CreateIndex(
 0106                name: "IX_WorkflowDefinition_Version",
 0107                schema: _schema.Schema,
 0108                table: "WorkflowDefinitions",
 0109                column: "Version");
 110
 0111            migrationBuilder.CreateIndex(
 0112                name: "IX_WorkflowInstance_CorrelationId",
 0113                schema: _schema.Schema,
 0114                table: "WorkflowInstances",
 0115                column: "CorrelationId");
 116
 0117            migrationBuilder.CreateIndex(
 0118                name: "IX_WorkflowInstance_CreatedAt",
 0119                schema: _schema.Schema,
 0120                table: "WorkflowInstances",
 0121                column: "CreatedAt");
 122
 0123            migrationBuilder.CreateIndex(
 0124                name: "IX_WorkflowInstance_DefinitionId",
 0125                schema: _schema.Schema,
 0126                table: "WorkflowInstances",
 0127                column: "DefinitionId");
 128
 0129            migrationBuilder.CreateIndex(
 0130                name: "IX_WorkflowInstance_FinishedAt",
 0131                schema: _schema.Schema,
 0132                table: "WorkflowInstances",
 0133                column: "FinishedAt");
 134
 0135            migrationBuilder.CreateIndex(
 0136                name: "IX_WorkflowInstance_Name",
 0137                schema: _schema.Schema,
 0138                table: "WorkflowInstances",
 0139                column: "Name");
 140
 0141            migrationBuilder.CreateIndex(
 0142                name: "IX_WorkflowInstance_Status",
 0143                schema: _schema.Schema,
 0144                table: "WorkflowInstances",
 0145                column: "Status");
 146
 0147            migrationBuilder.CreateIndex(
 0148                name: "IX_WorkflowInstance_Status_DefinitionId",
 0149                schema: _schema.Schema,
 0150                table: "WorkflowInstances",
 0151                columns: new[] { "Status", "DefinitionId" });
 152
 0153            migrationBuilder.CreateIndex(
 0154                name: "IX_WorkflowInstance_Status_SubStatus",
 0155                schema: _schema.Schema,
 0156                table: "WorkflowInstances",
 0157                columns: new[] { "Status", "SubStatus" });
 158
 0159            migrationBuilder.CreateIndex(
 0160                name: "IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version",
 0161                schema: _schema.Schema,
 0162                table: "WorkflowInstances",
 0163                columns: new[] { "Status", "SubStatus", "DefinitionId", "Version" });
 164
 0165            migrationBuilder.CreateIndex(
 0166                name: "IX_WorkflowInstance_SubStatus",
 0167                schema: _schema.Schema,
 0168                table: "WorkflowInstances",
 0169                column: "SubStatus");
 170
 0171            migrationBuilder.CreateIndex(
 0172                name: "IX_WorkflowInstance_SubStatus_DefinitionId",
 0173                schema: _schema.Schema,
 0174                table: "WorkflowInstances",
 0175                columns: new[] { "SubStatus", "DefinitionId" });
 176
 0177            migrationBuilder.CreateIndex(
 0178                name: "IX_WorkflowInstance_UpdatedAt",
 0179                schema: _schema.Schema,
 0180                table: "WorkflowInstances",
 0181                column: "UpdatedAt");
 0182        }
 183
 184        /// <inheritdoc />
 185        protected override void Down(MigrationBuilder migrationBuilder)
 186        {
 0187            migrationBuilder.DropTable(
 0188                name: "WorkflowDefinitions",
 0189                schema: _schema.Schema);
 190
 0191            migrationBuilder.DropTable(
 0192                name: "WorkflowInstances",
 0193                schema: _schema.Schema);
 0194        }
 195    }
 196}

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.PostgreSql/Migrations/Management/20231015122234_Initial.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using System;
 3using Elsa.Persistence.EFCore.Modules.Management;
 4using Microsoft.EntityFrameworkCore;
 5using Microsoft.EntityFrameworkCore.Infrastructure;
 6using Microsoft.EntityFrameworkCore.Migrations;
 7using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 8using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
 9
 10#nullable disable
 11
 12namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Management
 13{
 14    [DbContext(typeof(ManagementElsaDbContext))]
 15    [Migration("20231015122234_Initial")]
 16    partial class Initial
 17    {
 18        /// <inheritdoc />
 19        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 20        {
 21#pragma warning disable 612, 618
 022            modelBuilder
 023                .HasDefaultSchema("Elsa")
 024                .HasAnnotation("ProductVersion", "7.0.11")
 025                .HasAnnotation("Relational:MaxIdentifierLength", 63);
 26
 027            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
 28
 029            modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b =>
 030                {
 031                    b.Property<string>("Id")
 032                        .HasColumnType("text");
 033
 034                    b.Property<byte[]>("BinaryData")
 035                        .HasColumnType("bytea");
 036
 037                    b.Property<DateTimeOffset>("CreatedAt")
 038                        .HasColumnType("timestamp with time zone");
 039
 040                    b.Property<string>("Data")
 041                        .HasColumnType("text");
 042
 043                    b.Property<string>("DefinitionId")
 044                        .IsRequired()
 045                        .HasColumnType("text");
 046
 047                    b.Property<string>("Description")
 048                        .HasColumnType("text");
 049
 050                    b.Property<bool>("IsLatest")
 051                        .HasColumnType("boolean");
 052
 053                    b.Property<bool>("IsPublished")
 054                        .HasColumnType("boolean");
 055
 056                    b.Property<bool>("IsReadonly")
 057                        .HasColumnType("boolean");
 058
 059                    b.Property<string>("MaterializerContext")
 060                        .HasColumnType("text");
 061
 062                    b.Property<string>("MaterializerName")
 063                        .IsRequired()
 064                        .HasColumnType("text");
 065
 066                    b.Property<string>("Name")
 067                        .HasColumnType("text");
 068
 069                    b.Property<string>("ProviderName")
 070                        .HasColumnType("text");
 071
 072                    b.Property<string>("StringData")
 073                        .HasColumnType("text");
 074
 075                    b.Property<string>("ToolVersion")
 076                        .HasColumnType("text");
 077
 078                    b.Property<bool?>("UsableAsActivity")
 079                        .HasColumnType("boolean");
 080
 081                    b.Property<int>("Version")
 082                        .HasColumnType("integer");
 083
 084                    b.HasKey("Id");
 085
 086                    b.HasIndex("IsLatest")
 087                        .HasDatabaseName("IX_WorkflowDefinition_IsLatest");
 088
 089                    b.HasIndex("IsPublished")
 090                        .HasDatabaseName("IX_WorkflowDefinition_IsPublished");
 091
 092                    b.HasIndex("Name")
 093                        .HasDatabaseName("IX_WorkflowDefinition_Name");
 094
 095                    b.HasIndex("UsableAsActivity")
 096                        .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity");
 097
 098                    b.HasIndex("Version")
 099                        .HasDatabaseName("IX_WorkflowDefinition_Version");
 0100
 0101                    b.HasIndex("DefinitionId", "Version")
 0102                        .IsUnique()
 0103                        .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version");
 0104
 0105                    b.ToTable("WorkflowDefinitions", "Elsa");
 0106                });
 107
 0108            modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b =>
 0109                {
 0110                    b.Property<string>("Id")
 0111                        .HasColumnType("text");
 0112
 0113                    b.Property<string>("CorrelationId")
 0114                        .HasColumnType("text");
 0115
 0116                    b.Property<DateTimeOffset>("CreatedAt")
 0117                        .HasColumnType("timestamp with time zone");
 0118
 0119                    b.Property<string>("Data")
 0120                        .HasColumnType("text");
 0121
 0122                    b.Property<string>("DefinitionId")
 0123                        .IsRequired()
 0124                        .HasColumnType("text");
 0125
 0126                    b.Property<string>("DefinitionVersionId")
 0127                        .IsRequired()
 0128                        .HasColumnType("text");
 0129
 0130                    b.Property<DateTimeOffset?>("FinishedAt")
 0131                        .HasColumnType("timestamp with time zone");
 0132
 0133                    b.Property<int>("IncidentCount")
 0134                        .HasColumnType("integer");
 0135
 0136                    b.Property<string>("Name")
 0137                        .HasColumnType("text");
 0138
 0139                    b.Property<string>("Status")
 0140                        .IsRequired()
 0141                        .HasColumnType("text");
 0142
 0143                    b.Property<string>("SubStatus")
 0144                        .IsRequired()
 0145                        .HasColumnType("text");
 0146
 0147                    b.Property<DateTimeOffset>("UpdatedAt")
 0148                        .HasColumnType("timestamp with time zone");
 0149
 0150                    b.Property<int>("Version")
 0151                        .HasColumnType("integer");
 0152
 0153                    b.HasKey("Id");
 0154
 0155                    b.HasIndex("CorrelationId")
 0156                        .HasDatabaseName("IX_WorkflowInstance_CorrelationId");
 0157
 0158                    b.HasIndex("CreatedAt")
 0159                        .HasDatabaseName("IX_WorkflowInstance_CreatedAt");
 0160
 0161                    b.HasIndex("DefinitionId")
 0162                        .HasDatabaseName("IX_WorkflowInstance_DefinitionId");
 0163
 0164                    b.HasIndex("FinishedAt")
 0165                        .HasDatabaseName("IX_WorkflowInstance_FinishedAt");
 0166
 0167                    b.HasIndex("Name")
 0168                        .HasDatabaseName("IX_WorkflowInstance_Name");
 0169
 0170                    b.HasIndex("Status")
 0171                        .HasDatabaseName("IX_WorkflowInstance_Status");
 0172
 0173                    b.HasIndex("SubStatus")
 0174                        .HasDatabaseName("IX_WorkflowInstance_SubStatus");
 0175
 0176                    b.HasIndex("UpdatedAt")
 0177                        .HasDatabaseName("IX_WorkflowInstance_UpdatedAt");
 0178
 0179                    b.HasIndex("Status", "DefinitionId")
 0180                        .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId");
 0181
 0182                    b.HasIndex("Status", "SubStatus")
 0183                        .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus");
 0184
 0185                    b.HasIndex("SubStatus", "DefinitionId")
 0186                        .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId");
 0187
 0188                    b.HasIndex("Status", "SubStatus", "DefinitionId", "Version")
 0189                        .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version");
 0190
 0191                    b.ToTable("WorkflowInstances", "Elsa");
 0192                });
 193#pragma warning restore 612, 618
 0194        }
 195    }
 196}