mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add documents by machine.
This commit is contained in:
7700
Cicm.Database/Migrations/20190616235255_AddDocumentssByMachine.Designer.cs
generated
Normal file
7700
Cicm.Database/Migrations/20190616235255_AddDocumentssByMachine.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class AddDocumentssByMachine : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("DocumentsByMachines",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DocumentId = table.Column<long>(),
|
||||
MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentsByMachines", x => x.Id);
|
||||
table.ForeignKey("FK_DocumentsByMachines_Documents_DocumentId",
|
||||
x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_DocumentsByMachines_machines_MachineId",
|
||||
x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentsByMachines_DocumentId", "DocumentsByMachines", "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentsByMachines_MachineId", "DocumentsByMachines", "MachineId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("DocumentsByMachines");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -581,6 +581,23 @@ namespace Cicm.Database.Migrations
|
||||
new {Id = "wst", Enabled = true, Name = "Writer of supplementary textual content"});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.DocumentsByMachine", b =>
|
||||
{
|
||||
b.Property<long>("Id").ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<long>("DocumentId");
|
||||
|
||||
b.Property<int>("MachineId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("MachineId");
|
||||
|
||||
b.ToTable("DocumentsByMachines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.Forbidden", b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
|
||||
@@ -5312,6 +5329,15 @@ namespace Cicm.Database.Migrations
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.DocumentsByMachine", b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Document", "Document").WithMany("Machines").HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Cicm.Database.Models.Machine", "Machine").WithMany("Documents").HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.Gpu",
|
||||
b =>
|
||||
{
|
||||
|
||||
@@ -8,5 +8,6 @@ namespace Cicm.Database.Models
|
||||
|
||||
public virtual ICollection<PeopleByDocument> People { get; set; }
|
||||
public virtual ICollection<CompaniesByDocument> Companies { get; set; }
|
||||
public virtual ICollection<DocumentsByMachine> Machines { get; set; }
|
||||
}
|
||||
}
|
||||
11
Cicm.Database/Models/DocumentsByMachine.cs
Normal file
11
Cicm.Database/Models/DocumentsByMachine.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class DocumentsByMachine : BaseModel<long>
|
||||
{
|
||||
public long DocumentId { get; set; }
|
||||
public int MachineId { get; set; }
|
||||
|
||||
public virtual Document Document { get; set; }
|
||||
public virtual Machine Machine { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ namespace Cicm.Database.Models
|
||||
public virtual ICollection<StorageByMachine> Storage { get; set; }
|
||||
public virtual ICollection<MachinePhoto> Photos { get; set; }
|
||||
public virtual ICollection<ScreensByMachine> Screens { get; set; }
|
||||
public virtual ICollection<DocumentsByMachine> Documents { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[DisplayName("Introduced")]
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<PeopleByDocument> PeopleByDocuments { get; set; }
|
||||
public virtual DbSet<DocumentCompany> DocumentCompanies { get; set; }
|
||||
public virtual DbSet<CompaniesByDocument> CompaniesByDocuments { get; set; }
|
||||
public virtual DbSet<DocumentsByMachine> DocumentsByMachines { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -327,6 +328,17 @@ namespace Cicm.Database.Models
|
||||
entity.Property(p => p.Enabled).HasDefaultValue(true);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentsByMachine>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.DocumentId);
|
||||
|
||||
entity.HasIndex(e => e.MachineId);
|
||||
|
||||
entity.HasOne(d => d.Document).WithMany(p => p.Machines).HasForeignKey(d => d.DocumentId);
|
||||
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Documents).HasForeignKey(d => d.MachineId);
|
||||
});
|
||||
|
||||
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.822</Version>
|
||||
<Version>3.0.99.823</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