using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PARR.DAL.Migrations { /// public partial class TblHostsRelToTemplate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "HostId", table: "Templates", type: "uuid", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); migrationBuilder.AddColumn( 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); } /// 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"); } } }