shoc-backend/Data.SeaHavenIndustries/Migrations/20231220093346_commentsdatabasechange.cs
2024-09-28 14:58:36 -04:00

143 lines
4.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.SeaHavenIndustries.Migrations
{
/// <inheritdoc />
public partial class commentsdatabasechange : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Quotes_workOrders_ProposalforId",
table: "Quotes");
migrationBuilder.DropColumn(
name: "Latitude",
table: "Comments");
migrationBuilder.DropColumn(
name: "Longitude",
table: "Comments");
migrationBuilder.DropColumn(
name: "Name",
table: "Comments");
migrationBuilder.RenameColumn(
name: "ProposalforId",
table: "Quotes",
newName: "WorkorderId");
migrationBuilder.RenameColumn(
name: "POC",
table: "Quotes",
newName: "BillingAddress");
migrationBuilder.RenameIndex(
name: "IX_Quotes_ProposalforId",
table: "Quotes",
newName: "IX_Quotes_WorkorderId");
migrationBuilder.RenameColumn(
name: "Title",
table: "Comments",
newName: "Commenttext");
migrationBuilder.AddColumn<string>(
name: "UserId",
table: "Comments",
type: "nvarchar(450)",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Comments_UserId",
table: "Comments",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_Comments_AspNetUsers_UserId",
table: "Comments",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Quotes_workOrders_WorkorderId",
table: "Quotes",
column: "WorkorderId",
principalTable: "workOrders",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Comments_AspNetUsers_UserId",
table: "Comments");
migrationBuilder.DropForeignKey(
name: "FK_Quotes_workOrders_WorkorderId",
table: "Quotes");
migrationBuilder.DropIndex(
name: "IX_Comments_UserId",
table: "Comments");
migrationBuilder.DropColumn(
name: "UserId",
table: "Comments");
migrationBuilder.RenameColumn(
name: "WorkorderId",
table: "Quotes",
newName: "ProposalforId");
migrationBuilder.RenameColumn(
name: "BillingAddress",
table: "Quotes",
newName: "POC");
migrationBuilder.RenameIndex(
name: "IX_Quotes_WorkorderId",
table: "Quotes",
newName: "IX_Quotes_ProposalforId");
migrationBuilder.RenameColumn(
name: "Commenttext",
table: "Comments",
newName: "Title");
migrationBuilder.AddColumn<string>(
name: "Latitude",
table: "Comments",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Longitude",
table: "Comments",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Comments",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Quotes_workOrders_ProposalforId",
table: "Quotes",
column: "ProposalforId",
principalTable: "workOrders",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}