Связь Hosts & templates. Переделал респонс для get all templates

This commit is contained in:
Mikhail Trubnikov
2023-09-19 15:47:50 +10:00
parent 7b17d3260d
commit bb2e063d2f
7 changed files with 1471 additions and 17 deletions

View File

@@ -0,0 +1,81 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblHostsRelToTemplate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "HostId",
table: "Templates",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "HostId",
table: "Hosts",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Templates_HostId",
table: "Templates",
column: "HostId");
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");
migrationBuilder.AddForeignKey(
name: "FK_Templates_Hosts_HostId",
table: "Templates",
column: "HostId",
principalTable: "Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Hosts_Hosts_HostId",
table: "Hosts");
migrationBuilder.DropForeignKey(
name: "FK_Templates_Hosts_HostId",
table: "Templates");
migrationBuilder.DropIndex(
name: "IX_Templates_HostId",
table: "Templates");
migrationBuilder.DropIndex(
name: "IX_Hosts_HostId",
table: "Hosts");
migrationBuilder.DropColumn(
name: "HostId",
table: "Templates");
migrationBuilder.DropColumn(
name: "HostId",
table: "Hosts");
}
}
}