Added configurations for entity builders. Also added VoiceWorkLocaalization entity.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using JSMR.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace JSMR.Infrastructure.Data.Configuration;
|
||||
|
||||
public sealed class VoiceWorkSearchConfiguration : IEntityTypeConfiguration<VoiceWorkSearch>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<VoiceWorkSearch> builder)
|
||||
{
|
||||
builder.ToTable("voice_work_searches");
|
||||
builder.HasKey(x => x.VoiceWorkId); // also the FK
|
||||
|
||||
builder.Property(x => x.SearchText).IsRequired(); // TEXT/LONGTEXT
|
||||
|
||||
builder.HasOne(x => x.VoiceWork)
|
||||
.WithOne() // not navigated from VoiceWork in your model
|
||||
.HasForeignKey<VoiceWorkSearch>(x => x.VoiceWorkId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// MariaDB/MySQL (Pomelo) fulltext (BOOLEAN/NATURAL) — create an FT index
|
||||
// Pomelo supports .HasMethod("FULLTEXT"). If your version doesn't, add it in a migration SQL.
|
||||
//builder.HasIndex(x => x.SearchText)
|
||||
// .HasDatabaseName("FT_SearchText")
|
||||
// .HasMethod("FULLTEXT");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user