< Summary

Line coverage
93%
Covered lines: 109
Uncovered lines: 7
Coverable lines: 116
Total lines: 169
Line coverage: 93.9%
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.SqlServer/Migrations/Labels/20231015122257_Initial.cs

#LineLine coverage
 1
 2using Microsoft.EntityFrameworkCore.Migrations;
 3
 4#nullable disable
 5
 6namespace Elsa.Persistence.EFCore.SqlServer.Migrations.Labels
 7{
 8    /// <inheritdoc />
 9    public partial class Initial : Migration
 10    {
 11        private readonly IElsaDbContextSchema _schema;
 312        public Initial(IElsaDbContextSchema schema)
 13        {
 314            _schema = schema ?? throw new ArgumentNullException(nameof(schema));
 315        }
 16        /// <inheritdoc />
 17        protected override void Up(MigrationBuilder migrationBuilder)
 18        {
 319            migrationBuilder.EnsureSchema(
 320                name: _schema.Schema);
 21
 322            migrationBuilder.CreateTable(
 323                name: "Labels",
 324                schema: _schema.Schema,
 325                columns: table => new
 326                {
 327                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
 328                    Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
 329                    NormalizedName = table.Column<string>(type: "nvarchar(max)", nullable: false),
 330                    Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
 331                    Color = table.Column<string>(type: "nvarchar(max)", nullable: true)
 332                },
 333                constraints: table =>
 334                {
 335                    table.PrimaryKey("PK_Labels", x => x.Id);
 636                });
 37
 338            migrationBuilder.CreateTable(
 339                name: "WorkflowDefinitionLabels",
 340                schema: _schema.Schema,
 341                columns: table => new
 342                {
 343                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
 344                    WorkflowDefinitionId = table.Column<string>(type: "nvarchar(450)", nullable: false),
 345                    WorkflowDefinitionVersionId = table.Column<string>(type: "nvarchar(450)", nullable: false),
 346                    LabelId = table.Column<string>(type: "nvarchar(450)", nullable: false)
 347                },
 348                constraints: table =>
 349                {
 350                    table.PrimaryKey("PK_WorkflowDefinitionLabels", x => x.Id);
 651                });
 52
 353            migrationBuilder.CreateIndex(
 354                name: "WorkflowDefinitionLabel_LabelId",
 355                schema: _schema.Schema,
 356                table: "WorkflowDefinitionLabels",
 357                column: "LabelId");
 58
 359            migrationBuilder.CreateIndex(
 360                name: "WorkflowDefinitionLabel_WorkflowDefinitionId",
 361                schema: _schema.Schema,
 362                table: "WorkflowDefinitionLabels",
 363                column: "WorkflowDefinitionId");
 64
 365            migrationBuilder.CreateIndex(
 366                name: "WorkflowDefinitionLabel_WorkflowDefinitionVersionId",
 367                schema: _schema.Schema,
 368                table: "WorkflowDefinitionLabels",
 369                column: "WorkflowDefinitionVersionId");
 370        }
 71
 72        /// <inheritdoc />
 73        protected override void Down(MigrationBuilder migrationBuilder)
 74        {
 075            migrationBuilder.DropTable(
 076                name: "Labels",
 077                schema: _schema.Schema);
 78
 079            migrationBuilder.DropTable(
 080                name: "WorkflowDefinitionLabels",
 081                schema: _schema.Schema);
 082        }
 83    }
 84}

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.SqlServer/Migrations/Labels/20231015122257_Initial.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using Elsa.Persistence.EFCore.Modules.Labels;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Infrastructure;
 5using Microsoft.EntityFrameworkCore.Metadata;
 6using Microsoft.EntityFrameworkCore.Migrations;
 7using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 8
 9#nullable disable
 10
 11namespace Elsa.Persistence.EFCore.SqlServer.Migrations.Labels
 12{
 13    [DbContext(typeof(LabelsElsaDbContext))]
 14    [Migration("20231015122257_Initial")]
 15    partial class Initial
 16    {
 17        /// <inheritdoc />
 18        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 19        {
 20#pragma warning disable 612, 618
 321            modelBuilder
 322                .HasDefaultSchema("Elsa")
 323                .HasAnnotation("ProductVersion", "7.0.11")
 324                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 25
 326            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 27
 328            modelBuilder.Entity("Elsa.Labels.Entities.Label", b =>
 329                {
 330                    b.Property<string>("Id")
 331                        .HasColumnType("nvarchar(450)");
 332
 333                    b.Property<string>("Color")
 334                        .HasColumnType("nvarchar(max)");
 335
 336                    b.Property<string>("Description")
 337                        .HasColumnType("nvarchar(max)");
 338
 339                    b.Property<string>("Name")
 340                        .IsRequired()
 341                        .HasColumnType("nvarchar(max)");
 342
 343                    b.Property<string>("NormalizedName")
 344                        .IsRequired()
 345                        .HasColumnType("nvarchar(max)");
 346
 347                    b.HasKey("Id");
 348
 349                    b.ToTable("Labels", "Elsa");
 650                });
 51
 352            modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b =>
 353                {
 354                    b.Property<string>("Id")
 355                        .HasColumnType("nvarchar(450)");
 356
 357                    b.Property<string>("LabelId")
 358                        .IsRequired()
 359                        .HasColumnType("nvarchar(450)");
 360
 361                    b.Property<string>("WorkflowDefinitionId")
 362                        .IsRequired()
 363                        .HasColumnType("nvarchar(450)");
 364
 365                    b.Property<string>("WorkflowDefinitionVersionId")
 366                        .IsRequired()
 367                        .HasColumnType("nvarchar(450)");
 368
 369                    b.HasKey("Id");
 370
 371                    b.HasIndex("LabelId")
 372                        .HasDatabaseName("WorkflowDefinitionLabel_LabelId");
 373
 374                    b.HasIndex("WorkflowDefinitionId")
 375                        .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId");
 376
 377                    b.HasIndex("WorkflowDefinitionVersionId")
 378                        .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId");
 379
 380                    b.ToTable("WorkflowDefinitionLabels", "Elsa");
 681                });
 82#pragma warning restore 612, 618
 383        }
 84    }
 85}