mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add books by machine family.
This commit is contained in:
7947
Cicm.Database/Migrations/20190617021725_AddBooksByMachineFamily.Designer.cs
generated
Normal file
7947
Cicm.Database/Migrations/20190617021725_AddBooksByMachineFamily.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class AddBooksByMachineFamily : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("BooksByMachineFamilies",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
BookId = table.Column<long>(),
|
||||
MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BooksByMachineFamilies", x => x.Id);
|
||||
table.ForeignKey("FK_BooksByMachineFamilies_Books_BookId", x => x.BookId,
|
||||
"Books", "Id", onDelete: ReferentialAction.Cascade);
|
||||
table
|
||||
.ForeignKey("FK_BooksByMachineFamilies_machine_families_MachineFamilyId",
|
||||
x => x.MachineFamilyId, "machine_families", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_BooksByMachineFamilies_BookId", "BooksByMachineFamilies", "BookId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_BooksByMachineFamilies_MachineFamilyId", "BooksByMachineFamilies",
|
||||
"MachineFamilyId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("BooksByMachineFamilies");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,23 @@ namespace Cicm.Database.Migrations
|
||||
b.ToTable("BooksByMachines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.BooksByMachineFamily", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<long>("BookId");
|
||||
|
||||
b.Property<int>("MachineFamilyId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BookId");
|
||||
|
||||
b.HasIndex("MachineFamilyId");
|
||||
|
||||
b.ToTable("BooksByMachineFamilies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.BrowserTest", b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||
@@ -5421,6 +5438,15 @@ namespace Cicm.Database.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.BooksByMachineFamily", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Book", "Book").WithMany("MachineFamilies").HasForeignKey("BookId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Cicm.Database.Models.MachineFamily", "MachineFamily").WithMany("Books")
|
||||
.HasForeignKey("MachineFamilyId").OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.CompaniesByBook", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Book", "Book").WithMany("Companies").HasForeignKey("BookId")
|
||||
|
||||
@@ -20,5 +20,6 @@ namespace Cicm.Database.Models
|
||||
public virtual ICollection<CompaniesByBook> Companies { get; set; }
|
||||
public virtual ICollection<PeopleByBook> People { get; set; }
|
||||
public virtual ICollection<BooksByMachine> Machines { get; set; }
|
||||
public virtual ICollection<BooksByMachineFamily> MachineFamilies { get; set; }
|
||||
}
|
||||
}
|
||||
11
Cicm.Database/Models/BooksByMachineFamily.cs
Normal file
11
Cicm.Database/Models/BooksByMachineFamily.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class BooksByMachineFamily : BaseModel<long>
|
||||
{
|
||||
public long BookId { get; set; }
|
||||
public int MachineFamilyId { get; set; }
|
||||
|
||||
public virtual Book Book { get; set; }
|
||||
public virtual MachineFamily MachineFamily { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -48,5 +48,6 @@ namespace Cicm.Database.Models
|
||||
public virtual Company Company { get; set; }
|
||||
public virtual ICollection<Machine> Machines { get; set; }
|
||||
public virtual ICollection<DocumentsByMachineFamily> Documents { get; set; }
|
||||
public virtual ICollection<BooksByMachineFamily> Books { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,7 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<CompaniesByBook> CompaniesByBooks { get; set; }
|
||||
public virtual DbSet<PeopleByBook> PeopleByBooks { get; set; }
|
||||
public virtual DbSet<BooksByMachine> BooksByMachines { get; set; }
|
||||
public virtual DbSet<BooksByMachineFamily> BooksByMachineFamilies { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -141,6 +142,17 @@ namespace Cicm.Database.Models
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Books).HasForeignKey(d => d.MachineId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<BooksByMachineFamily>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.BookId);
|
||||
|
||||
entity.HasIndex(e => e.MachineFamilyId);
|
||||
|
||||
entity.HasOne(d => d.Book).WithMany(p => p.MachineFamilies).HasForeignKey(d => d.BookId);
|
||||
|
||||
entity.HasOne(d => d.MachineFamily).WithMany(p => p.Books).HasForeignKey(d => d.MachineFamilyId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<BrowserTest>(entity =>
|
||||
{
|
||||
entity.ToTable("browser_tests");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.828</Version>
|
||||
<Version>3.0.99.829</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user