mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add books.
This commit is contained in:
@@ -85,6 +85,7 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<DocumentCompany> DocumentCompanies { get; set; }
|
||||
public virtual DbSet<CompaniesByDocument> CompaniesByDocuments { get; set; }
|
||||
public virtual DbSet<DocumentsByMachine> DocumentsByMachines { get; set; }
|
||||
public virtual DbSet<Book> Books { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -99,6 +100,33 @@ namespace Cicm.Database.Models
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<Book>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Title);
|
||||
|
||||
entity.HasIndex(e => e.NativeTitle);
|
||||
|
||||
entity.HasIndex(e => e.Published);
|
||||
|
||||
entity.HasIndex(e => e.CountryId);
|
||||
|
||||
entity.HasIndex(e => e.Synopsis).ForMySqlIsFullText();
|
||||
|
||||
entity.HasIndex(e => e.Isbn);
|
||||
|
||||
entity.HasIndex(e => e.Pages);
|
||||
|
||||
entity.HasIndex(e => e.Edition);
|
||||
|
||||
entity.HasOne(d => d.Previous).WithOne(d => d.Next).HasForeignKey<Book>(d => d.PreviousId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull);
|
||||
|
||||
entity.HasOne(d => d.Source).WithMany(d => d.Derivates).HasForeignKey(d => d.SourceId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull);
|
||||
|
||||
entity.HasOne(d => d.Country).WithMany(p => p.Books).HasForeignKey(d => d.CountryId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<BrowserTest>(entity =>
|
||||
{
|
||||
entity.ToTable("browser_tests");
|
||||
|
||||
Reference in New Issue
Block a user