mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add people by company entity.
This commit is contained in:
5831
Cicm.Database/Migrations/20190605142832_AddPeopleByCompany.Designer.cs
generated
Normal file
5831
Cicm.Database/Migrations/20190605142832_AddPeopleByCompany.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Cicm.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class AddPeopleByCompany : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PeopleByCompany",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
PersonId = table.Column<int>(nullable: false),
|
||||||
|
CompanyId = table.Column<int>(nullable: false),
|
||||||
|
Position = table.Column<string>(nullable: true),
|
||||||
|
Start = table.Column<DateTime>(nullable: true),
|
||||||
|
End = table.Column<DateTime>(nullable: true),
|
||||||
|
Ongoing = table.Column<bool>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PeopleByCompany", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PeopleByCompany_companies_CompanyId",
|
||||||
|
column: x => x.CompanyId,
|
||||||
|
principalTable: "companies",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PeopleByCompany_People_PersonId",
|
||||||
|
column: x => x.PersonId,
|
||||||
|
principalTable: "People",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PeopleByCompany_CompanyId",
|
||||||
|
table: "PeopleByCompany",
|
||||||
|
column: "CompanyId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PeopleByCompany_End",
|
||||||
|
table: "PeopleByCompany",
|
||||||
|
column: "End");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PeopleByCompany_PersonId",
|
||||||
|
table: "PeopleByCompany",
|
||||||
|
column: "PersonId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PeopleByCompany_Position",
|
||||||
|
table: "PeopleByCompany",
|
||||||
|
column: "Position");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PeopleByCompany_Start",
|
||||||
|
table: "PeopleByCompany",
|
||||||
|
column: "Start");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PeopleByCompany");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -650,7 +650,6 @@ namespace Cicm.Database.Migrations
|
|||||||
b.HasIndex("Type");
|
b.HasIndex("Type");
|
||||||
|
|
||||||
b.ToTable("ISO_639-3");
|
b.ToTable("ISO_639-3");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Cicm.Database.Models.License", b =>
|
modelBuilder.Entity("Cicm.Database.Models.License", b =>
|
||||||
@@ -4601,6 +4600,38 @@ namespace Cicm.Database.Migrations
|
|||||||
b.ToTable("OwnedMachinePhotos");
|
b.ToTable("OwnedMachinePhotos");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Cicm.Database.Models.PeopleByCompany", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("CompanyId");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("End");
|
||||||
|
|
||||||
|
b.Property<bool>("Ongoing");
|
||||||
|
|
||||||
|
b.Property<int>("PersonId");
|
||||||
|
|
||||||
|
b.Property<string>("Position");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("Start");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CompanyId");
|
||||||
|
|
||||||
|
b.HasIndex("End");
|
||||||
|
|
||||||
|
b.HasIndex("PersonId");
|
||||||
|
|
||||||
|
b.HasIndex("Position");
|
||||||
|
|
||||||
|
b.HasIndex("Start");
|
||||||
|
|
||||||
|
b.ToTable("PeopleByCompany");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Cicm.Database.Models.Person", b =>
|
modelBuilder.Entity("Cicm.Database.Models.Person", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -5585,6 +5616,19 @@ namespace Cicm.Database.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Cicm.Database.Models.PeopleByCompany", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Cicm.Database.Models.Company", "Company")
|
||||||
|
.WithMany("People")
|
||||||
|
.HasForeignKey("CompanyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("Cicm.Database.Models.Person", "Person")
|
||||||
|
.WithMany("Companies")
|
||||||
|
.HasForeignKey("PersonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Cicm.Database.Models.Person", b =>
|
modelBuilder.Entity("Cicm.Database.Models.Person", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Cicm.Database.Models.Iso31661Numeric", "CountryOfBirth")
|
b.HasOne("Cicm.Database.Models.Iso31661Numeric", "CountryOfBirth")
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ namespace Cicm.Database.Models
|
|||||||
public virtual ICollection<Machine> Machines { get; set; }
|
public virtual ICollection<Machine> Machines { get; set; }
|
||||||
public virtual ICollection<Processor> Processors { get; set; }
|
public virtual ICollection<Processor> Processors { get; set; }
|
||||||
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
||||||
|
public virtual ICollection<PeopleByCompany> People { get; set; }
|
||||||
public virtual CompanyLogo LastLogo =>
|
public virtual CompanyLogo LastLogo =>
|
||||||
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
|
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
|
||||||
|
|
||||||
|
|||||||
17
Cicm.Database/Models/PeopleByCompany.cs
Normal file
17
Cicm.Database/Models/PeopleByCompany.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Cicm.Database.Models
|
||||||
|
{
|
||||||
|
public class PeopleByCompany : BaseModel<long>
|
||||||
|
{
|
||||||
|
public int PersonId { get; set; }
|
||||||
|
public int CompanyId { get; set; }
|
||||||
|
public string Position { get; set; }
|
||||||
|
public DateTime? Start { get; set; }
|
||||||
|
public DateTime? End { get; set; }
|
||||||
|
public bool Ongoing { get; set; }
|
||||||
|
|
||||||
|
public virtual Person Person { get; set; }
|
||||||
|
public virtual Company Company { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
@@ -22,5 +23,6 @@ namespace Cicm.Database.Models
|
|||||||
public string FullName => $"{Name} {Surname}";
|
public string FullName => $"{Name} {Surname}";
|
||||||
|
|
||||||
public short? CountryOfBirthId { get; set; }
|
public short? CountryOfBirthId { get; set; }
|
||||||
|
public virtual ICollection<PeopleByCompany> Companies { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -776,6 +776,23 @@ namespace Cicm.Database.Models
|
|||||||
entity.Property(e => e.Type).HasColumnName("type").HasColumnType("int(11)").HasDefaultValueSql("'0'");
|
entity.Property(e => e.Type).HasColumnName("type").HasColumnType("int(11)").HasDefaultValueSql("'0'");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<PeopleByCompany>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasIndex(e => e.PersonId);
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.CompanyId);
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Position);
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Start);
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.End);
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Person).WithMany(p => p.Companies).HasForeignKey(d => d.PersonId);
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Company).WithMany(p => p.People).HasForeignKey(d => d.CompanyId);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Person>(entity =>
|
modelBuilder.Entity<Person>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasIndex(e => e.Name);
|
entity.HasIndex(e => e.Name);
|
||||||
|
|||||||
@@ -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.806</Version>
|
<Version>3.0.99.807</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