mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add documents by machine family.
This commit is contained in:
@@ -9,8 +9,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(cicmContext))]
|
||||
[Migration("20190616235255_AddDocumentssByMachine")]
|
||||
partial class AddDocumentssByMachine
|
||||
[Migration("20190616235255_AddDocumentsByMachine")]
|
||||
partial class AddDocumentsByMachine
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class AddDocumentssByMachine : Migration
|
||||
public partial class AddDocumentsByMachine : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
7731
Cicm.Database/Migrations/20190617010136_AddDocumentsByMachineFamily.Designer.cs
generated
Normal file
7731
Cicm.Database/Migrations/20190617010136_AddDocumentsByMachineFamily.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class AddDocumentsByMachineFamily : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("DocumentsByMachineFamily",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DocumentId = table.Column<long>(),
|
||||
MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentsByMachineFamily", x => x.Id);
|
||||
table.ForeignKey("FK_DocumentsByMachineFamily_Documents_DocumentId",
|
||||
x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table
|
||||
.ForeignKey("FK_DocumentsByMachineFamily_machine_families_MachineFamilyId",
|
||||
x => x.MachineFamilyId, "machine_families", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentsByMachineFamily_DocumentId", "DocumentsByMachineFamily",
|
||||
"DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentsByMachineFamily_MachineFamilyId", "DocumentsByMachineFamily",
|
||||
"MachineFamilyId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("DocumentsByMachineFamily");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -598,6 +598,23 @@ namespace Cicm.Database.Migrations
|
||||
b.ToTable("DocumentsByMachines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.DocumentsByMachineFamily", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<long>("DocumentId");
|
||||
|
||||
b.Property<int>("MachineFamilyId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("MachineFamilyId");
|
||||
|
||||
b.ToTable("DocumentsByMachineFamily");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.Forbidden", b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||
@@ -5338,6 +5355,15 @@ namespace Cicm.Database.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.DocumentsByMachineFamily", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Document", "Document").WithMany("MachineFamilies")
|
||||
.HasForeignKey("DocumentId").OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Cicm.Database.Models.MachineFamily", "MachineFamily").WithMany("Documents")
|
||||
.HasForeignKey("MachineFamilyId").OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.Gpu",
|
||||
b =>
|
||||
{
|
||||
|
||||
@@ -6,8 +6,9 @@ namespace Cicm.Database.Models
|
||||
{
|
||||
public virtual Iso31661Numeric Country { get; set; }
|
||||
|
||||
public virtual ICollection<PeopleByDocument> People { get; set; }
|
||||
public virtual ICollection<CompaniesByDocument> Companies { get; set; }
|
||||
public virtual ICollection<DocumentsByMachine> Machines { get; set; }
|
||||
public virtual ICollection<PeopleByDocument> People { get; set; }
|
||||
public virtual ICollection<CompaniesByDocument> Companies { get; set; }
|
||||
public virtual ICollection<DocumentsByMachine> Machines { get; set; }
|
||||
public virtual ICollection<DocumentsByMachineFamily> MachineFamilies { get; set; }
|
||||
}
|
||||
}
|
||||
11
Cicm.Database/Models/DocumentsByMachineFamily.cs
Normal file
11
Cicm.Database/Models/DocumentsByMachineFamily.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class DocumentsByMachineFamily : BaseModel<long>
|
||||
{
|
||||
public long DocumentId { get; set; }
|
||||
public int MachineFamilyId { get; set; }
|
||||
|
||||
public virtual Document Document { get; set; }
|
||||
public virtual MachineFamily MachineFamily { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,8 @@ namespace Cicm.Database.Models
|
||||
[StringLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual Company Company { get; set; }
|
||||
public virtual ICollection<Machine> Machines { get; set; }
|
||||
public virtual Company Company { get; set; }
|
||||
public virtual ICollection<Machine> Machines { get; set; }
|
||||
public virtual ICollection<DocumentsByMachineFamily> Documents { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -339,6 +339,17 @@ namespace Cicm.Database.Models
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Documents).HasForeignKey(d => d.MachineId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentsByMachineFamily>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.DocumentId);
|
||||
|
||||
entity.HasIndex(e => e.MachineFamilyId);
|
||||
|
||||
entity.HasOne(d => d.Document).WithMany(p => p.MachineFamilies).HasForeignKey(d => d.DocumentId);
|
||||
|
||||
entity.HasOne(d => d.MachineFamily).WithMany(p => p.Documents).HasForeignKey(d => d.MachineFamilyId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Forbidden>(entity =>
|
||||
{
|
||||
entity.ToTable("forbidden");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.823</Version>
|
||||
<Version>3.0.99.824</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