PhoneToolMX/PhoneToolMX.Models/Migrations/20231020213049_PrimaryExtensionAsExtension.cs

46 lines
1.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PhoneToolMX.Models.Migrations
{
public partial class PrimaryExtensionAsExtension : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "PrimaryExtension",
table: "Phones",
newName: "PrimaryExtensionId");
migrationBuilder.CreateIndex(
name: "IX_Phones_PrimaryExtensionId",
table: "Phones",
column: "PrimaryExtensionId");
migrationBuilder.AddForeignKey(
name: "FK_Phones_Extensions_PrimaryExtensionId",
table: "Phones",
column: "PrimaryExtensionId",
principalTable: "Extensions",
principalColumn: "Id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Phones_Extensions_PrimaryExtensionId",
table: "Phones");
migrationBuilder.DropIndex(
name: "IX_Phones_PrimaryExtensionId",
table: "Phones");
migrationBuilder.RenameColumn(
name: "PrimaryExtensionId",
table: "Phones",
newName: "PrimaryExtension");
}
}
}