| | | 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 durable audit-completion outbox persistence. |
| | | 9 | | /// </summary> |
| | | 10 | | public sealed class ApplicationAuditCompletionOutboxEntryConfiguration |
| | | 11 | | : IEntityTypeConfiguration<ApplicationAuditCompletionOutboxEntry> |
| | | 12 | | { |
| | | 13 | | /// <inheritdoc /> |
| | | 14 | | public void Configure(EntityTypeBuilder<ApplicationAuditCompletionOutboxEntry> builder) |
| | | 15 | | { |
| | 8 | 16 | | builder.ToTable("ApplicationAuditCompletionOutbox"); |
| | | 17 | | |
| | 8 | 18 | | builder.HasKey(entry => entry.Id); |
| | 8 | 19 | | builder.Property(entry => entry.Id).ValueGeneratedNever(); |
| | | 20 | | |
| | 8 | 21 | | builder.Property(entry => entry.SchemaVersion) |
| | 8 | 22 | | .HasMaxLength(32) |
| | 8 | 23 | | .IsRequired(); |
| | 8 | 24 | | builder.Property(entry => entry.Destination) |
| | 8 | 25 | | .HasMaxLength(128) |
| | 8 | 26 | | .IsRequired(); |
| | 8 | 27 | | builder.Property(entry => entry.IdempotencyKey) |
| | 8 | 28 | | .HasMaxLength(128) |
| | 8 | 29 | | .IsRequired(); |
| | 8 | 30 | | builder.Property(entry => entry.MutationBatchId) |
| | 8 | 31 | | .HasMaxLength(64) |
| | 8 | 32 | | .IsRequired(); |
| | 8 | 33 | | builder.Property(entry => entry.PersistenceOutcome) |
| | 8 | 34 | | .HasMaxLength(64) |
| | 8 | 35 | | .IsRequired(); |
| | 8 | 36 | | builder.Property(entry => entry.MutationManifestHash) |
| | 8 | 37 | | .HasMaxLength(256) |
| | 8 | 38 | | .IsRequired(); |
| | 8 | 39 | | builder.Property(entry => entry.MutationManifestAlgorithm) |
| | 8 | 40 | | .HasMaxLength(64) |
| | 8 | 41 | | .IsRequired(); |
| | 8 | 42 | | builder.Property(entry => entry.MutationManifestSchemaVersion) |
| | 8 | 43 | | .HasMaxLength(32) |
| | 8 | 44 | | .IsRequired(); |
| | 8 | 45 | | builder.Property(entry => entry.OperationExecutionId).HasMaxLength(128); |
| | 8 | 46 | | builder.Property(entry => entry.ExecutionAttemptId).HasMaxLength(128); |
| | 8 | 47 | | builder.Property(entry => entry.DecisionAuditRecordId).HasMaxLength(128); |
| | 8 | 48 | | builder.Property(entry => entry.CorrelationId).HasMaxLength(128); |
| | 8 | 49 | | builder.Property(entry => entry.TraceId).HasMaxLength(64); |
| | 8 | 50 | | builder.Property(entry => entry.Status) |
| | 8 | 51 | | .HasMaxLength(32) |
| | 8 | 52 | | .IsRequired(); |
| | 8 | 53 | | builder.Property(entry => entry.LastErrorCode).HasMaxLength(128); |
| | 8 | 54 | | builder.Property(entry => entry.LastErrorMessage).HasMaxLength(512); |
| | | 55 | | |
| | 8 | 56 | | builder.HasIndex(entry => entry.IdempotencyKey).IsUnique(); |
| | 8 | 57 | | builder.HasIndex(entry => new { entry.Destination, entry.MutationBatchId }).IsUnique(); |
| | 8 | 58 | | builder.HasIndex(entry => new { entry.Status, entry.NextAttemptUtc }); |
| | 8 | 59 | | builder.HasIndex(entry => entry.CreatedUtc); |
| | 8 | 60 | | } |
| | | 61 | | } |