diff --git a/src/ScadaLink.ConfigurationDatabase/Configurations/NotificationOutboxConfiguration.cs b/src/ScadaLink.ConfigurationDatabase/Configurations/NotificationOutboxConfiguration.cs index ba6b814..4009c56 100644 --- a/src/ScadaLink.ConfigurationDatabase/Configurations/NotificationOutboxConfiguration.cs +++ b/src/ScadaLink.ConfigurationDatabase/Configurations/NotificationOutboxConfiguration.cs @@ -13,19 +13,42 @@ public class NotificationOutboxConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("Notifications"); builder.HasKey(n => n.NotificationId); + builder.Property(n => n.NotificationId).HasMaxLength(64); - builder.Property(n => n.Type).HasConversion().HasMaxLength(32).IsRequired(); - builder.Property(n => n.Status).HasConversion().HasMaxLength(32).IsRequired(); - builder.Property(n => n.ListName).HasMaxLength(200).IsRequired(); - builder.Property(n => n.Subject).HasMaxLength(1000).IsRequired(); + + builder.Property(n => n.Type) + .HasConversion() + .HasMaxLength(32) + .IsRequired(); + + builder.Property(n => n.Status) + .HasConversion() + .HasMaxLength(32) + .IsRequired(); + + builder.Property(n => n.ListName) + .HasMaxLength(200) + .IsRequired(); + + builder.Property(n => n.Subject) + .HasMaxLength(1000) + .IsRequired(); + builder.Property(n => n.Body).IsRequired(); + builder.Property(n => n.LastError).HasMaxLength(4000); - builder.Property(n => n.SourceSiteId).HasMaxLength(100).IsRequired(); + + builder.Property(n => n.SourceSiteId) + .HasMaxLength(100) + .IsRequired(); + builder.Property(n => n.SourceInstanceId).HasMaxLength(200); + builder.Property(n => n.SourceScript).HasMaxLength(200); + builder.HasIndex(n => new { n.Status, n.NextAttemptAt }); + builder.HasIndex(n => new { n.SourceSiteId, n.CreatedAt }); } }