82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|