fix Hosts

This commit is contained in:
Mikhail Trubnikov
2023-09-20 09:52:51 +10:00
parent 87f81d5ed6
commit e10b591c1b
4 changed files with 1497 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblHostsFixRElToTemplate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Hosts_Hosts_HostId",
table: "Hosts");
migrationBuilder.DropIndex(
name: "IX_Hosts_HostId",
table: "Hosts");
migrationBuilder.DropColumn(
name: "HostId",
table: "Hosts");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "HostId",
table: "Hosts",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Hosts_HostId",
table: "Hosts",
column: "HostId");
migrationBuilder.AddForeignKey(
name: "FK_Hosts_Hosts_HostId",
table: "Hosts",
column: "HostId",
principalTable: "Hosts",
principalColumn: "Id");
}
}
}

View File

@@ -518,9 +518,6 @@ namespace PARR.DAL.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("HostId")
.HasColumnType("uuid");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
@@ -536,8 +533,6 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.HasIndex("HostId");
b.ToTable("Hosts");
});
@@ -1192,13 +1187,6 @@ namespace PARR.DAL.Migrations
b.Navigation("Work");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.HasOne("PARR.DAL.Models.Host", null)
.WithMany("Hosts")
.HasForeignKey("HostId");
});
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
{
b.HasOne("PARR.DAL.Models.Process", "Process")
@@ -1219,7 +1207,7 @@ namespace PARR.DAL.Migrations
.IsRequired();
b.HasOne("PARR.DAL.Models.Host", "Host")
.WithMany()
.WithMany("Templates")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -1379,7 +1367,7 @@ namespace PARR.DAL.Migrations
{
b.Navigation("ApplicationsInHosts");
b.Navigation("Hosts");
b.Navigation("Templates");
});
modelBuilder.Entity("PARR.DAL.Models.Process", b =>

View File

@@ -30,6 +30,6 @@ namespace PARR.DAL.Models
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
public ICollection<Host> Hosts { get; set; } = new HashSet<Host>();
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
}
}