| | | 1 | | using Microsoft.EntityFrameworkCore; |
| | | 2 | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | 3 | | using ProjectTemplate.Infrastructure.Data.Entities; |
| | | 4 | | |
| | | 5 | | namespace ProjectTemplate.Infrastructure.Data.Configurations; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Configures the EF Core mapping for <see cref="AuditRecord"/>. |
| | | 9 | | /// </summary> |
| | | 10 | | public sealed class AuditRecordConfiguration : IEntityTypeConfiguration<AuditRecord> |
| | | 11 | | { |
| | | 12 | | /// <inheritdoc /> |
| | | 13 | | public void Configure(EntityTypeBuilder<AuditRecord> builder) |
| | | 14 | | { |
| | 8 | 15 | | builder.ToTable("AuditRecords"); |
| | | 16 | | |
| | 8 | 17 | | builder.HasKey(x => x.Id); |
| | | 18 | | |
| | 8 | 19 | | builder.Property(x => x.Id) |
| | 8 | 20 | | .ValueGeneratedNever(); |
| | | 21 | | |
| | 8 | 22 | | builder.Property(x => x.SchemaVersion) |
| | 8 | 23 | | .HasMaxLength(32) |
| | 8 | 24 | | .IsRequired(); |
| | | 25 | | |
| | 8 | 26 | | builder.Property(x => x.ModifiedBy) |
| | 8 | 27 | | .HasMaxLength(200) |
| | 8 | 28 | | .IsRequired(); |
| | | 29 | | |
| | 8 | 30 | | builder.Property(x => x.ActorId) |
| | 8 | 31 | | .HasMaxLength(256) |
| | 8 | 32 | | .IsRequired(); |
| | | 33 | | |
| | 8 | 34 | | builder.Property(x => x.ActorType) |
| | 8 | 35 | | .HasMaxLength(64) |
| | 8 | 36 | | .IsRequired(); |
| | | 37 | | |
| | 8 | 38 | | builder.Property(x => x.ModifiedOnUtc) |
| | 8 | 39 | | .IsRequired(); |
| | | 40 | | |
| | 8 | 41 | | builder.Property(x => x.Application) |
| | 8 | 42 | | .HasMaxLength(200) |
| | 8 | 43 | | .IsRequired(); |
| | | 44 | | |
| | 8 | 45 | | builder.Property(x => x.Entity) |
| | 8 | 46 | | .HasMaxLength(200) |
| | 8 | 47 | | .IsRequired(); |
| | | 48 | | |
| | 8 | 49 | | builder.Property(x => x.State) |
| | 8 | 50 | | .HasMaxLength(100) |
| | 8 | 51 | | .IsRequired(); |
| | | 52 | | |
| | 8 | 53 | | builder.Property(x => x.MutationBatchId) |
| | 8 | 54 | | .HasMaxLength(64) |
| | 8 | 55 | | .IsRequired(); |
| | | 56 | | |
| | 8 | 57 | | builder.Property(x => x.OperationExecutionId) |
| | 8 | 58 | | .HasMaxLength(128); |
| | | 59 | | |
| | 8 | 60 | | builder.Property(x => x.ExecutionAttemptId) |
| | 8 | 61 | | .HasMaxLength(128); |
| | | 62 | | |
| | 8 | 63 | | builder.Property(x => x.CorrelationId) |
| | 8 | 64 | | .HasMaxLength(128); |
| | | 65 | | |
| | 8 | 66 | | builder.Property(x => x.TraceId) |
| | 8 | 67 | | .HasMaxLength(64); |
| | | 68 | | |
| | 8 | 69 | | builder.Property(x => x.SpanId) |
| | 8 | 70 | | .HasMaxLength(32); |
| | | 71 | | |
| | 8 | 72 | | builder.Property(x => x.DecisionAuditRecordId) |
| | 8 | 73 | | .HasMaxLength(128); |
| | | 74 | | |
| | 8 | 75 | | builder.Property(x => x.TenantHash) |
| | 8 | 76 | | .HasMaxLength(128); |
| | | 77 | | |
| | 8 | 78 | | builder.Property(x => x.OrganizationHash) |
| | 8 | 79 | | .HasMaxLength(128); |
| | | 80 | | |
| | 8 | 81 | | builder.Property(x => x.KeyValues) |
| | 8 | 82 | | .IsRequired(); |
| | | 83 | | |
| | 8 | 84 | | builder.Property(x => x.OriginalValues) |
| | 8 | 85 | | .IsRequired(); |
| | | 86 | | |
| | 8 | 87 | | builder.Property(x => x.CurrentValues) |
| | 8 | 88 | | .IsRequired(); |
| | | 89 | | |
| | 8 | 90 | | builder.HasIndex(x => x.MutationBatchId); |
| | 8 | 91 | | builder.HasIndex(x => x.OperationExecutionId); |
| | 8 | 92 | | builder.HasIndex(x => x.CorrelationId); |
| | 8 | 93 | | builder.HasIndex(x => x.DecisionAuditRecordId); |
| | 8 | 94 | | } |
| | | 95 | | } |