< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 116
Coverable lines: 116
Total lines: 169
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/Labels/20231015122304_Initial.cs

#LineLine coverage
 1
 2using Microsoft.EntityFrameworkCore.Migrations;
 3
 4#nullable disable
 5
 6namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Labels
 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: "Labels",
 024                schema: _schema.Schema,
 025                columns: table => new
 026                {
 027                    Id = table.Column<string>(type: "text", nullable: false),
 028                    Name = table.Column<string>(type: "text", nullable: false),
 029                    NormalizedName = table.Column<string>(type: "text", nullable: false),
 030                    Description = table.Column<string>(type: "text", nullable: true),
 031                    Color = table.Column<string>(type: "text", nullable: true)
 032                },
 033                constraints: table =>
 034                {
 035                    table.PrimaryKey("PK_Labels", x => x.Id);
 036                });
 37
 038            migrationBuilder.CreateTable(
 039                name: "WorkflowDefinitionLabels",
 040                schema: _schema.Schema,
 041                columns: table => new
 042                {
 043                    Id = table.Column<string>(type: "text", nullable: false),
 044                    WorkflowDefinitionId = table.Column<string>(type: "text", nullable: false),
 045                    WorkflowDefinitionVersionId = table.Column<string>(type: "text", nullable: false),
 046                    LabelId = table.Column<string>(type: "text", nullable: false)
 047                },
 048                constraints: table =>
 049                {
 050                    table.PrimaryKey("PK_WorkflowDefinitionLabels", x => x.Id);
 051                });
 52
 053            migrationBuilder.CreateIndex(
 054                name: "WorkflowDefinitionLabel_LabelId",
 055                schema: _schema.Schema,
 056                table: "WorkflowDefinitionLabels",
 057                column: "LabelId");
 58
 059            migrationBuilder.CreateIndex(
 060                name: "WorkflowDefinitionLabel_WorkflowDefinitionId",
 061                schema: _schema.Schema,
 062                table: "WorkflowDefinitionLabels",
 063                column: "WorkflowDefinitionId");
 64
 065            migrationBuilder.CreateIndex(
 066                name: "WorkflowDefinitionLabel_WorkflowDefinitionVersionId",
 067                schema: _schema.Schema,
 068                table: "WorkflowDefinitionLabels",
 069                column: "WorkflowDefinitionVersionId");
 070        }
 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.PostgreSql/Migrations/Labels/20231015122304_Initial.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using Elsa.Persistence.EFCore.Modules.Labels;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Infrastructure;
 5using Microsoft.EntityFrameworkCore.Migrations;
 6using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 7using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
 8
 9#nullable disable
 10
 11namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Labels
 12{
 13    [DbContext(typeof(LabelsElsaDbContext))]
 14    [Migration("20231015122304_Initial")]
 15    partial class Initial
 16    {
 17        /// <inheritdoc />
 18        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 19        {
 20#pragma warning disable 612, 618
 021            modelBuilder
 022                .HasDefaultSchema("Elsa")
 023                .HasAnnotation("ProductVersion", "7.0.11")
 024                .HasAnnotation("Relational:MaxIdentifierLength", 63);
 25
 026            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
 27
 028            modelBuilder.Entity("Elsa.Labels.Entities.Label", b =>
 029                {
 030                    b.Property<string>("Id")
 031                        .HasColumnType("text");
 032
 033                    b.Property<string>("Color")
 034                        .HasColumnType("text");
 035
 036                    b.Property<string>("Description")
 037                        .HasColumnType("text");
 038
 039                    b.Property<string>("Name")
 040                        .IsRequired()
 041                        .HasColumnType("text");
 042
 043                    b.Property<string>("NormalizedName")
 044                        .IsRequired()
 045                        .HasColumnType("text");
 046
 047                    b.HasKey("Id");
 048
 049                    b.ToTable("Labels", "Elsa");
 050                });
 51
 052            modelBuilder.Entity("Elsa.Labels.Entities.WorkflowDefinitionLabel", b =>
 053                {
 054                    b.Property<string>("Id")
 055                        .HasColumnType("text");
 056
 057                    b.Property<string>("LabelId")
 058                        .IsRequired()
 059                        .HasColumnType("text");
 060
 061                    b.Property<string>("WorkflowDefinitionId")
 062                        .IsRequired()
 063                        .HasColumnType("text");
 064
 065                    b.Property<string>("WorkflowDefinitionVersionId")
 066                        .IsRequired()
 067                        .HasColumnType("text");
 068
 069                    b.HasKey("Id");
 070
 071                    b.HasIndex("LabelId")
 072                        .HasDatabaseName("WorkflowDefinitionLabel_LabelId");
 073
 074                    b.HasIndex("WorkflowDefinitionId")
 075                        .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionId");
 076
 077                    b.HasIndex("WorkflowDefinitionVersionId")
 078                        .HasDatabaseName("WorkflowDefinitionLabel_WorkflowDefinitionVersionId");
 079
 080                    b.ToTable("WorkflowDefinitionLabels", "Elsa");
 081                });
 82#pragma warning restore 612, 618
 083        }
 84    }
 85}