initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
public class ScannedDocumentConfiguration : IEntityTypeConfiguration<ScannedDocument>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ScannedDocument> builder)
|
||||
{
|
||||
builder.ToTable("scanned_documents");
|
||||
builder.HasKey(d => d.Id);
|
||||
builder.Property(d => d.Id).HasColumnName("id").HasDefaultValueSql("gen_random_uuid()");
|
||||
builder.Property(d => d.BatchId).HasColumnName("batch_id").IsRequired();
|
||||
builder.Property(d => d.ObjectKey).HasColumnName("object_key").HasMaxLength(500).IsRequired();
|
||||
builder.Property(d => d.Sha256).HasColumnName("sha256").HasMaxLength(64).IsRequired();
|
||||
builder.Property(d => d.ContentType).HasColumnName("content_type").HasMaxLength(100).IsRequired();
|
||||
builder.Property(d => d.FileSizeBytes).HasColumnName("file_size_bytes").IsRequired();
|
||||
builder.Property(d => d.UploadedAt).HasColumnName("uploaded_at").HasDefaultValueSql("NOW()");
|
||||
|
||||
builder.HasOne(d => d.Batch).WithOne(b => b.Document).HasForeignKey<ScannedDocument>(d => d.BatchId).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasIndex(d => d.Sha256);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user