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
|
namespace Cicm.Database.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(cicmContext))]
|
[DbContext(typeof(cicmContext))]
|
||||||
[Migration("20190616235255_AddDocumentssByMachine")]
|
[Migration("20190616235255_AddDocumentsByMachine")]
|
||||||
partial class AddDocumentssByMachine
|
partial class AddDocumentsByMachine
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
namespace Cicm.Database.Migrations
|
namespace Cicm.Database.Migrations
|
||||||
{
|
{
|
||||||
public partial class AddDocumentssByMachine : Migration
|
public partial class AddDocumentsByMachine : Migration
|
||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
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");
|
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 =>
|
modelBuilder.Entity("Cicm.Database.Models.Forbidden", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||||
@@ -5338,6 +5355,15 @@ namespace Cicm.Database.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade);
|
.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",
|
modelBuilder.Entity("Cicm.Database.Models.Gpu",
|
||||||
b =>
|
b =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ namespace Cicm.Database.Models
|
|||||||
{
|
{
|
||||||
public virtual Iso31661Numeric Country { get; set; }
|
public virtual Iso31661Numeric Country { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<PeopleByDocument> People { get; set; }
|
public virtual ICollection<PeopleByDocument> People { get; set; }
|
||||||
public virtual ICollection<CompaniesByDocument> Companies { get; set; }
|
public virtual ICollection<CompaniesByDocument> Companies { get; set; }
|
||||||
public virtual ICollection<DocumentsByMachine> Machines { 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)]
|
[StringLength(255)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public virtual Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
public virtual ICollection<Machine> Machines { 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);
|
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 =>
|
modelBuilder.Entity<Forbidden>(entity =>
|
||||||
{
|
{
|
||||||
entity.ToTable("forbidden");
|
entity.ToTable("forbidden");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.823</Version>
|
<Version>3.0.99.824</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user