< Summary

Line coverage
97%
Covered lines: 316
Uncovered lines: 7
Coverable lines: 323
Total lines: 392
Line coverage: 97.8%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

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;
 212        public Initial(IElsaDbContextSchema schema)
 13        {
 214            _schema = schema ?? throw new ArgumentNullException(nameof(schema));
 215        }
 16        /// <inheritdoc />
 17        protected override void Up(MigrationBuilder migrationBuilder)
 18        {
 219            migrationBuilder.EnsureSchema(
 220                name: _schema.Schema);
 21
 222            migrationBuilder.CreateTable(
 223                name: "WorkflowDefinitions",
 224                schema: _schema.Schema,
 225                columns: table => new
 226                {
 227                    Id = table.Column<string>(type: "text", nullable: false),
 228                    DefinitionId = table.Column<string>(type: "text", nullable: false),
 229                    Name = table.Column<string>(type: "text", nullable: true),
 230                    Description = table.Column<string>(type: "text", nullable: true),
 231                    ToolVersion = table.Column<string>(type: "text", nullable: true),
 232                    ProviderName = table.Column<string>(type: "text", nullable: true),
 233                    MaterializerName = table.Column<string>(type: "text", nullable: false),
 234                    MaterializerContext = table.Column<string>(type: "text", nullable: true),
 235                    StringData = table.Column<string>(type: "text", nullable: true),
 236                    BinaryData = table.Column<byte[]>(type: "bytea", nullable: true),
 237                    IsReadonly = table.Column<bool>(type: "boolean", nullable: false),
 238                    Data = table.Column<string>(type: "text", nullable: true),
 239                    UsableAsActivity = table.Column<bool>(type: "boolean", nullable: true),
 240                    CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 241                    Version = table.Column<int>(type: "integer", nullable: false),
 242                    IsLatest = table.Column<bool>(type: "boolean", nullable: false),
 243                    IsPublished = table.Column<bool>(type: "boolean", nullable: false)
 244                },
 245                constraints: table =>
 246                {
 247                    table.PrimaryKey("PK_WorkflowDefinitions", x => x.Id);
 448                });
 49
 250            migrationBuilder.CreateTable(
 251                name: "WorkflowInstances",
 252                schema: _schema.Schema,
 253                columns: table => new
 254                {
 255                    Id = table.Column<string>(type: "text", nullable: false),
 256                    DefinitionId = table.Column<string>(type: "text", nullable: false),
 257                    DefinitionVersionId = table.Column<string>(type: "text", nullable: false),
 258                    Version = table.Column<int>(type: "integer", nullable: false),
 259                    Status = table.Column<string>(type: "text", nullable: false),
 260                    SubStatus = table.Column<string>(type: "text", nullable: false),
 261                    CorrelationId = table.Column<string>(type: "text", nullable: true),
 262                    Name = table.Column<string>(type: "text", nullable: true),
 263                    IncidentCount = table.Column<int>(type: "integer", nullable: false),
 264                    CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 265                    UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 266                    FinishedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
 267                    Data = table.Column<string>(type: "text", nullable: true)
 268                },
 269                constraints: table =>
 270                {
 271                    table.PrimaryKey("PK_WorkflowInstances", x => x.Id);
 472                });
 73
 274            migrationBuilder.CreateIndex(
 275                name: "IX_WorkflowDefinition_DefinitionId_Version",
 276                schema: _schema.Schema,
 277                table: "WorkflowDefinitions",
 278                columns: new[] { "DefinitionId", "Version" },
 279                unique: true);
 80
 281            migrationBuilder.CreateIndex(
 282                name: "IX_WorkflowDefinition_IsLatest",
 283                schema: _schema.Schema,
 284                table: "WorkflowDefinitions",
 285                column: "IsLatest");
 86
 287            migrationBuilder.CreateIndex(
 288                name: "IX_WorkflowDefinition_IsPublished",
 289                schema: _schema.Schema,
 290                table: "WorkflowDefinitions",
 291                column: "IsPublished");
 92
 293            migrationBuilder.CreateIndex(
 294                name: "IX_WorkflowDefinition_Name",
 295                schema: _schema.Schema,
 296                table: "WorkflowDefinitions",
 297                column: "Name");
 98
 299            migrationBuilder.CreateIndex(
 2100                name: "IX_WorkflowDefinition_UsableAsActivity",
 2101                schema: _schema.Schema,
 2102                table: "WorkflowDefinitions",
 2103                column: "UsableAsActivity");
 104
 2105            migrationBuilder.CreateIndex(
 2106                name: "IX_WorkflowDefinition_Version",
 2107                schema: _schema.Schema,
 2108                table: "WorkflowDefinitions",
 2109                column: "Version");
 110
 2111            migrationBuilder.CreateIndex(
 2112                name: "IX_WorkflowInstance_CorrelationId",
 2113                schema: _schema.Schema,
 2114                table: "WorkflowInstances",
 2115                column: "CorrelationId");
 116
 2117            migrationBuilder.CreateIndex(
 2118                name: "IX_WorkflowInstance_CreatedAt",
 2119                schema: _schema.Schema,
 2120                table: "WorkflowInstances",
 2121                column: "CreatedAt");
 122
 2123            migrationBuilder.CreateIndex(
 2124                name: "IX_WorkflowInstance_DefinitionId",
 2125                schema: _schema.Schema,
 2126                table: "WorkflowInstances",
 2127                column: "DefinitionId");
 128
 2129            migrationBuilder.CreateIndex(
 2130                name: "IX_WorkflowInstance_FinishedAt",
 2131                schema: _schema.Schema,
 2132                table: "WorkflowInstances",
 2133                column: "FinishedAt");
 134
 2135            migrationBuilder.CreateIndex(
 2136                name: "IX_WorkflowInstance_Name",
 2137                schema: _schema.Schema,
 2138                table: "WorkflowInstances",
 2139                column: "Name");
 140
 2141            migrationBuilder.CreateIndex(
 2142                name: "IX_WorkflowInstance_Status",
 2143                schema: _schema.Schema,
 2144                table: "WorkflowInstances",
 2145                column: "Status");
 146
 2147            migrationBuilder.CreateIndex(
 2148                name: "IX_WorkflowInstance_Status_DefinitionId",
 2149                schema: _schema.Schema,
 2150                table: "WorkflowInstances",
 2151                columns: new[] { "Status", "DefinitionId" });
 152
 2153            migrationBuilder.CreateIndex(
 2154                name: "IX_WorkflowInstance_Status_SubStatus",
 2155                schema: _schema.Schema,
 2156                table: "WorkflowInstances",
 2157                columns: new[] { "Status", "SubStatus" });
 158
 2159            migrationBuilder.CreateIndex(
 2160                name: "IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version",
 2161                schema: _schema.Schema,
 2162                table: "WorkflowInstances",
 2163                columns: new[] { "Status", "SubStatus", "DefinitionId", "Version" });
 164
 2165            migrationBuilder.CreateIndex(
 2166                name: "IX_WorkflowInstance_SubStatus",
 2167                schema: _schema.Schema,
 2168                table: "WorkflowInstances",
 2169                column: "SubStatus");
 170
 2171            migrationBuilder.CreateIndex(
 2172                name: "IX_WorkflowInstance_SubStatus_DefinitionId",
 2173                schema: _schema.Schema,
 2174                table: "WorkflowInstances",
 2175                columns: new[] { "SubStatus", "DefinitionId" });
 176
 2177            migrationBuilder.CreateIndex(
 2178                name: "IX_WorkflowInstance_UpdatedAt",
 2179                schema: _schema.Schema,
 2180                table: "WorkflowInstances",
 2181                column: "UpdatedAt");
 2182        }
 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
 122            modelBuilder
 123                .HasDefaultSchema("Elsa")
 124                .HasAnnotation("ProductVersion", "7.0.11")
 125                .HasAnnotation("Relational:MaxIdentifierLength", 63);
 26
 127            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
 28
 129            modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b =>
 130                {
 131                    b.Property<string>("Id")
 132                        .HasColumnType("text");
 133
 134                    b.Property<byte[]>("BinaryData")
 135                        .HasColumnType("bytea");
 136
 137                    b.Property<DateTimeOffset>("CreatedAt")
 138                        .HasColumnType("timestamp with time zone");
 139
 140                    b.Property<string>("Data")
 141                        .HasColumnType("text");
 142
 143                    b.Property<string>("DefinitionId")
 144                        .IsRequired()
 145                        .HasColumnType("text");
 146
 147                    b.Property<string>("Description")
 148                        .HasColumnType("text");
 149
 150                    b.Property<bool>("IsLatest")
 151                        .HasColumnType("boolean");
 152
 153                    b.Property<bool>("IsPublished")
 154                        .HasColumnType("boolean");
 155
 156                    b.Property<bool>("IsReadonly")
 157                        .HasColumnType("boolean");
 158
 159                    b.Property<string>("MaterializerContext")
 160                        .HasColumnType("text");
 161
 162                    b.Property<string>("MaterializerName")
 163                        .IsRequired()
 164                        .HasColumnType("text");
 165
 166                    b.Property<string>("Name")
 167                        .HasColumnType("text");
 168
 169                    b.Property<string>("ProviderName")
 170                        .HasColumnType("text");
 171
 172                    b.Property<string>("StringData")
 173                        .HasColumnType("text");
 174
 175                    b.Property<string>("ToolVersion")
 176                        .HasColumnType("text");
 177
 178                    b.Property<bool?>("UsableAsActivity")
 179                        .HasColumnType("boolean");
 180
 181                    b.Property<int>("Version")
 182                        .HasColumnType("integer");
 183
 184                    b.HasKey("Id");
 185
 186                    b.HasIndex("IsLatest")
 187                        .HasDatabaseName("IX_WorkflowDefinition_IsLatest");
 188
 189                    b.HasIndex("IsPublished")
 190                        .HasDatabaseName("IX_WorkflowDefinition_IsPublished");
 191
 192                    b.HasIndex("Name")
 193                        .HasDatabaseName("IX_WorkflowDefinition_Name");
 194
 195                    b.HasIndex("UsableAsActivity")
 196                        .HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity");
 197
 198                    b.HasIndex("Version")
 199                        .HasDatabaseName("IX_WorkflowDefinition_Version");
 1100
 1101                    b.HasIndex("DefinitionId", "Version")
 1102                        .IsUnique()
 1103                        .HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version");
 1104
 1105                    b.ToTable("WorkflowDefinitions", "Elsa");
 2106                });
 107
 1108            modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b =>
 1109                {
 1110                    b.Property<string>("Id")
 1111                        .HasColumnType("text");
 1112
 1113                    b.Property<string>("CorrelationId")
 1114                        .HasColumnType("text");
 1115
 1116                    b.Property<DateTimeOffset>("CreatedAt")
 1117                        .HasColumnType("timestamp with time zone");
 1118
 1119                    b.Property<string>("Data")
 1120                        .HasColumnType("text");
 1121
 1122                    b.Property<string>("DefinitionId")
 1123                        .IsRequired()
 1124                        .HasColumnType("text");
 1125
 1126                    b.Property<string>("DefinitionVersionId")
 1127                        .IsRequired()
 1128                        .HasColumnType("text");
 1129
 1130                    b.Property<DateTimeOffset?>("FinishedAt")
 1131                        .HasColumnType("timestamp with time zone");
 1132
 1133                    b.Property<int>("IncidentCount")
 1134                        .HasColumnType("integer");
 1135
 1136                    b.Property<string>("Name")
 1137                        .HasColumnType("text");
 1138
 1139                    b.Property<string>("Status")
 1140                        .IsRequired()
 1141                        .HasColumnType("text");
 1142
 1143                    b.Property<string>("SubStatus")
 1144                        .IsRequired()
 1145                        .HasColumnType("text");
 1146
 1147                    b.Property<DateTimeOffset>("UpdatedAt")
 1148                        .HasColumnType("timestamp with time zone");
 1149
 1150                    b.Property<int>("Version")
 1151                        .HasColumnType("integer");
 1152
 1153                    b.HasKey("Id");
 1154
 1155                    b.HasIndex("CorrelationId")
 1156                        .HasDatabaseName("IX_WorkflowInstance_CorrelationId");
 1157
 1158                    b.HasIndex("CreatedAt")
 1159                        .HasDatabaseName("IX_WorkflowInstance_CreatedAt");
 1160
 1161                    b.HasIndex("DefinitionId")
 1162                        .HasDatabaseName("IX_WorkflowInstance_DefinitionId");
 1163
 1164                    b.HasIndex("FinishedAt")
 1165                        .HasDatabaseName("IX_WorkflowInstance_FinishedAt");
 1166
 1167                    b.HasIndex("Name")
 1168                        .HasDatabaseName("IX_WorkflowInstance_Name");
 1169
 1170                    b.HasIndex("Status")
 1171                        .HasDatabaseName("IX_WorkflowInstance_Status");
 1172
 1173                    b.HasIndex("SubStatus")
 1174                        .HasDatabaseName("IX_WorkflowInstance_SubStatus");
 1175
 1176                    b.HasIndex("UpdatedAt")
 1177                        .HasDatabaseName("IX_WorkflowInstance_UpdatedAt");
 1178
 1179                    b.HasIndex("Status", "DefinitionId")
 1180                        .HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId");
 1181
 1182                    b.HasIndex("Status", "SubStatus")
 1183                        .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus");
 1184
 1185                    b.HasIndex("SubStatus", "DefinitionId")
 1186                        .HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId");
 1187
 1188                    b.HasIndex("Status", "SubStatus", "DefinitionId", "Version")
 1189                        .HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version");
 1190
 1191                    b.ToTable("WorkflowInstances", "Elsa");
 2192                });
 193#pragma warning restore 612, 618
 1194        }
 195    }
 196}