< Summary

Line coverage
96%
Covered lines: 186
Uncovered lines: 7
Coverable lines: 193
Total lines: 254
Line coverage: 96.3%
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/Alterations/20231015122203_Initial.cs

#LineLine coverage
 1
 2using Microsoft.EntityFrameworkCore.Migrations;
 3
 4#nullable disable
 5
 6namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Alterations
 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: "AlterationJobs",
 224                schema: _schema.Schema,
 225                columns: table => new
 226                {
 227                    Id = table.Column<string>(type: "text", nullable: false),
 228                    PlanId = table.Column<string>(type: "text", nullable: false),
 229                    WorkflowInstanceId = table.Column<string>(type: "text", nullable: false),
 230                    Status = table.Column<int>(type: "integer", nullable: false),
 231                    CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 232                    StartedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
 233                    CompletedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
 234                    SerializedLog = table.Column<string>(type: "text", nullable: true)
 235                },
 236                constraints: table =>
 237                {
 238                    table.PrimaryKey("PK_AlterationJobs", x => x.Id);
 439                });
 40
 241            migrationBuilder.CreateTable(
 242                name: "AlterationPlans",
 243                schema: _schema.Schema,
 244                columns: table => new
 245                {
 246                    Id = table.Column<string>(type: "text", nullable: false),
 247                    Status = table.Column<int>(type: "integer", nullable: false),
 248                    CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
 249                    StartedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
 250                    CompletedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
 251                    SerializedAlterations = table.Column<string>(type: "text", nullable: true),
 252                    SerializedWorkflowInstanceIds = table.Column<string>(type: "text", nullable: true)
 253                },
 254                constraints: table =>
 255                {
 256                    table.PrimaryKey("PK_AlterationPlans", x => x.Id);
 457                });
 58
 259            migrationBuilder.CreateIndex(
 260                name: "IX_AlterationJob_CompletedAt",
 261                schema: _schema.Schema,
 262                table: "AlterationJobs",
 263                column: "CompletedAt");
 64
 265            migrationBuilder.CreateIndex(
 266                name: "IX_AlterationJob_CreatedAt",
 267                schema: _schema.Schema,
 268                table: "AlterationJobs",
 269                column: "CreatedAt");
 70
 271            migrationBuilder.CreateIndex(
 272                name: "IX_AlterationJob_PlanId",
 273                schema: _schema.Schema,
 274                table: "AlterationJobs",
 275                column: "PlanId");
 76
 277            migrationBuilder.CreateIndex(
 278                name: "IX_AlterationJob_StartedAt",
 279                schema: _schema.Schema,
 280                table: "AlterationJobs",
 281                column: "StartedAt");
 82
 283            migrationBuilder.CreateIndex(
 284                name: "IX_AlterationJob_Status",
 285                schema: _schema.Schema,
 286                table: "AlterationJobs",
 287                column: "Status");
 88
 289            migrationBuilder.CreateIndex(
 290                name: "IX_AlterationJob_WorkflowInstanceId",
 291                schema: _schema.Schema,
 292                table: "AlterationJobs",
 293                column: "WorkflowInstanceId");
 94
 295            migrationBuilder.CreateIndex(
 296                name: "IX_AlterationPlan_CompletedAt",
 297                schema: _schema.Schema,
 298                table: "AlterationPlans",
 299                column: "CompletedAt");
 100
 2101            migrationBuilder.CreateIndex(
 2102                name: "IX_AlterationPlan_CreatedAt",
 2103                schema: _schema.Schema,
 2104                table: "AlterationPlans",
 2105                column: "CreatedAt");
 106
 2107            migrationBuilder.CreateIndex(
 2108                name: "IX_AlterationPlan_StartedAt",
 2109                schema: _schema.Schema,
 2110                table: "AlterationPlans",
 2111                column: "StartedAt");
 112
 2113            migrationBuilder.CreateIndex(
 2114                name: "IX_AlterationPlan_Status",
 2115                schema: _schema.Schema,
 2116                table: "AlterationPlans",
 2117                column: "Status");
 2118        }
 119
 120        /// <inheritdoc />
 121        protected override void Down(MigrationBuilder migrationBuilder)
 122        {
 0123            migrationBuilder.DropTable(
 0124                name: "AlterationJobs",
 0125                schema: _schema.Schema);
 126
 0127            migrationBuilder.DropTable(
 0128                name: "AlterationPlans",
 0129                schema: _schema.Schema);
 0130        }
 131    }
 132}

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

#LineLine coverage
 1// <auto-generated />
 2using System;
 3using Elsa.Persistence.EFCore.Modules.Alterations;
 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.Alterations
 13{
 14    [DbContext(typeof(AlterationsElsaDbContext))]
 15    [Migration("20231015122203_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.Alterations.Core.Entities.AlterationJob", b =>
 130                {
 131                    b.Property<string>("Id")
 132                        .HasColumnType("text");
 133
 134                    b.Property<DateTimeOffset?>("CompletedAt")
 135                        .HasColumnType("timestamp with time zone");
 136
 137                    b.Property<DateTimeOffset>("CreatedAt")
 138                        .HasColumnType("timestamp with time zone");
 139
 140                    b.Property<string>("PlanId")
 141                        .IsRequired()
 142                        .HasColumnType("text");
 143
 144                    b.Property<string>("SerializedLog")
 145                        .HasColumnType("text");
 146
 147                    b.Property<DateTimeOffset?>("StartedAt")
 148                        .HasColumnType("timestamp with time zone");
 149
 150                    b.Property<int>("Status")
 151                        .HasColumnType("integer");
 152
 153                    b.Property<string>("WorkflowInstanceId")
 154                        .IsRequired()
 155                        .HasColumnType("text");
 156
 157                    b.HasKey("Id");
 158
 159                    b.HasIndex("CompletedAt")
 160                        .HasDatabaseName("IX_AlterationJob_CompletedAt");
 161
 162                    b.HasIndex("CreatedAt")
 163                        .HasDatabaseName("IX_AlterationJob_CreatedAt");
 164
 165                    b.HasIndex("PlanId")
 166                        .HasDatabaseName("IX_AlterationJob_PlanId");
 167
 168                    b.HasIndex("StartedAt")
 169                        .HasDatabaseName("IX_AlterationJob_StartedAt");
 170
 171                    b.HasIndex("Status")
 172                        .HasDatabaseName("IX_AlterationJob_Status");
 173
 174                    b.HasIndex("WorkflowInstanceId")
 175                        .HasDatabaseName("IX_AlterationJob_WorkflowInstanceId");
 176
 177                    b.ToTable("AlterationJobs", "Elsa");
 278                });
 79
 180            modelBuilder.Entity("Elsa.Alterations.Core.Entities.AlterationPlan", b =>
 181                {
 182                    b.Property<string>("Id")
 183                        .HasColumnType("text");
 184
 185                    b.Property<DateTimeOffset?>("CompletedAt")
 186                        .HasColumnType("timestamp with time zone");
 187
 188                    b.Property<DateTimeOffset>("CreatedAt")
 189                        .HasColumnType("timestamp with time zone");
 190
 191                    b.Property<string>("SerializedAlterations")
 192                        .HasColumnType("text");
 193
 194                    b.Property<string>("SerializedWorkflowInstanceIds")
 195                        .HasColumnType("text");
 196
 197                    b.Property<DateTimeOffset?>("StartedAt")
 198                        .HasColumnType("timestamp with time zone");
 199
 1100                    b.Property<int>("Status")
 1101                        .HasColumnType("integer");
 1102
 1103                    b.HasKey("Id");
 1104
 1105                    b.HasIndex("CompletedAt")
 1106                        .HasDatabaseName("IX_AlterationPlan_CompletedAt");
 1107
 1108                    b.HasIndex("CreatedAt")
 1109                        .HasDatabaseName("IX_AlterationPlan_CreatedAt");
 1110
 1111                    b.HasIndex("StartedAt")
 1112                        .HasDatabaseName("IX_AlterationPlan_StartedAt");
 1113
 1114                    b.HasIndex("Status")
 1115                        .HasDatabaseName("IX_AlterationPlan_Status");
 1116
 1117                    b.ToTable("AlterationPlans", "Elsa");
 2118                });
 119#pragma warning restore 612, 618
 1120        }
 121    }
 122}