< Summary

Information
Class: Elsa.Persistence.EFCore.PostgreSql.Handlers.SetupForPostgreSql
Assembly: Elsa.Persistence.EFCore.PostgreSql
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.PostgreSql/Handlers/SetupForPostgreSql.cs
Line coverage
87%
Covered lines: 7
Uncovered lines: 1
Coverable lines: 8
Total lines: 28
Line coverage: 87.5%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Handle(...)75%4487.5%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.PostgreSql/Handlers/SetupForPostgreSql.cs

#LineLine coverage
 1using Elsa.Persistence.EFCore.Extensions;
 2using Elsa.Workflows.Management.Entities;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Metadata;
 5
 6namespace Elsa.Persistence.EFCore.PostgreSql.Handlers;
 7
 8/// <summary>
 9/// Represents a class that handles entity model creation for SQLite databases.
 10/// </summary>
 11public class SetupForPostgreSql : IEntityModelCreatingHandler
 12{
 13    /// <inheritdoc />
 14    public void Handle(ElsaDbContextBase dbContext, ModelBuilder modelBuilder, IMutableEntityType entityType)
 15    {
 2916        if (!dbContext.Database.IsPostgres())
 017            return;
 18
 19        // Configure the WorkflowDefinition entity to use the PostgreSQL JSONB type for the StringData property:
 2920        if (entityType.ClrType == typeof(WorkflowDefinition))
 21        {
 122            modelBuilder
 123                .Entity(entityType.Name)
 124                .Property("StringData")
 125                .HasColumnType("jsonb");
 26        }
 2927    }
 28}