Связь Hosts & templates. Переделал респонс для get all templates
This commit is contained in:
81
PARR.DAL/Migrations/20230919052753_TblHostsRelToTemplate.cs
Normal file
81
PARR.DAL/Migrations/20230919052753_TblHostsRelToTemplate.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user