< 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
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 28
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Handle(...)0%2040%

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    {
 016        if (!dbContext.Database.IsPostgres())
 017            return;
 18
 19        // Configure the WorkflowDefinition entity to use the PostgreSQL JSONB type for the StringData property:
 020        if (entityType.ClrType == typeof(WorkflowDefinition))
 21        {
 022            modelBuilder
 023                .Entity(entityType.Name)
 024                .Property("StringData")
 025                .HasColumnType("jsonb");
 26        }
 027    }
 28}