mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Fix one to one relationship between company and document company.
This commit is contained in:
8186
Cicm.Database/Migrations/20190630103617_FixDocumentCompanyOneToOne.Designer.cs
generated
Normal file
8186
Cicm.Database/Migrations/20190630103617_FixDocumentCompanyOneToOne.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Cicm.Database.Migrations
|
||||
{
|
||||
public partial class FixDocumentCompanyOneToOne : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey("FK_companies_DocumentCompanies_DocumentCompanyId", "companies");
|
||||
|
||||
migrationBuilder.DropIndex("IX_companies_DocumentCompanyId", "companies");
|
||||
|
||||
migrationBuilder.AlterColumn<int>("CompanyId", "DocumentCompanies", nullable: true, oldClrType: typeof(int),
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey("FK_DocumentCompanies_companies_CompanyId", "DocumentCompanies", "CompanyId",
|
||||
"companies", principalColumn: "id", onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey("FK_DocumentCompanies_companies_CompanyId", "DocumentCompanies");
|
||||
|
||||
migrationBuilder.AlterColumn<int>("CompanyId", "DocumentCompanies", nullable: true, oldClrType: typeof(int),
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_companies_DocumentCompanyId", "companies", "DocumentCompanyId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey("FK_companies_DocumentCompanies_DocumentCompanyId", "companies",
|
||||
"DocumentCompanyId", "DocumentCompanies", principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,8 +285,6 @@ namespace Cicm.Database.Migrations
|
||||
|
||||
b.HasIndex("CountryId").HasName("idx_companies_country");
|
||||
|
||||
b.HasIndex("DocumentCompanyId").IsUnique();
|
||||
|
||||
b.HasIndex("Facebook").HasName("idx_companies_facebook");
|
||||
|
||||
b.HasIndex("Founded").HasName("idx_companies_founded");
|
||||
@@ -5634,9 +5632,6 @@ namespace Cicm.Database.Migrations
|
||||
b.HasOne("Cicm.Database.Models.Iso31661Numeric", "Country").WithMany("Companies")
|
||||
.HasForeignKey("CountryId").HasConstraintName("fk_companies_country");
|
||||
|
||||
b.HasOne("Cicm.Database.Models.DocumentCompany", "DocumentCompany").WithOne("Company")
|
||||
.HasForeignKey("Cicm.Database.Models.Company", "DocumentCompanyId").OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Cicm.Database.Models.Company", "SoldTo").WithMany("InverseSoldToNavigation")
|
||||
.HasForeignKey("SoldToId").HasConstraintName("fk_companies_sold_to");
|
||||
});
|
||||
@@ -5662,6 +5657,14 @@ namespace Cicm.Database.Migrations
|
||||
.HasForeignKey("CountryId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.DocumentCompany",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Cicm.Database.Models.Company", "Company").WithOne("DocumentCompany")
|
||||
.HasForeignKey("Cicm.Database.Models.DocumentCompany", "CompanyId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cicm.Database.Models.DocumentPerson",
|
||||
b =>
|
||||
{
|
||||
|
||||
@@ -388,9 +388,6 @@ namespace Cicm.Database.Models
|
||||
entity.HasIndex(e => e.Name);
|
||||
|
||||
entity.HasIndex(e => e.CompanyId).IsUnique();
|
||||
|
||||
entity.HasOne(d => d.Company).WithOne(p => p.DocumentCompany)
|
||||
.HasForeignKey<Company>(d => d.DocumentCompanyId).OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentPerson>(entity =>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.846</Version>
|
||||
<Version>3.0.99.856</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