mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add magazines.
This commit is contained in:
@@ -50,5 +50,6 @@ namespace Cicm.Database.Models
|
||||
public virtual ICollection<Person> People { get; set; }
|
||||
public virtual ICollection<Document> Documents { get; set; }
|
||||
public virtual ICollection<Book> Books { get; set; }
|
||||
public virtual ICollection<Magazine> Magazines { get; set; }
|
||||
}
|
||||
}
|
||||
16
Cicm.Database/Models/Magazine.cs
Normal file
16
Cicm.Database/Models/Magazine.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class Magazine : DocumentBase
|
||||
{
|
||||
[StringLength(8, MinimumLength = 8)]
|
||||
public string Issn { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime? FirstPublication { get; set; }
|
||||
|
||||
public virtual Iso31661Numeric Country { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<PeopleByBook> PeopleByBooks { get; set; }
|
||||
public virtual DbSet<BooksByMachine> BooksByMachines { get; set; }
|
||||
public virtual DbSet<BooksByMachineFamily> BooksByMachineFamilies { get; set; }
|
||||
public virtual DbSet<Magazine> Magazines { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -852,6 +853,25 @@ namespace Cicm.Database.Models
|
||||
entity.HasOne(d => d.License).WithMany(p => p.OwnedMachinePhotos).OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Magazine>(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.Issn);
|
||||
|
||||
entity.HasIndex(e => e.FirstPublication);
|
||||
|
||||
entity.HasOne(d => d.Country).WithMany(p => p.Magazines).HasForeignKey(d => d.CountryId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MemoryByMachine>(entity =>
|
||||
{
|
||||
entity.ToTable("memory_by_machine");
|
||||
|
||||
Reference in New Issue
Block a user