using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DrinkRateAPI.Migrations
{
///
public partial class HistoryUpdatedByField : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UpdateRecords_UserProfiles_UserProfileId",
table: "UpdateRecords");
migrationBuilder.RenameColumn(
name: "UserProfileId",
table: "UpdateRecords",
newName: "UpdatedByUserProfileId");
migrationBuilder.RenameIndex(
name: "IX_UpdateRecords_UserProfileId",
table: "UpdateRecords",
newName: "IX_UpdateRecords_UpdatedByUserProfileId");
migrationBuilder.AddColumn(
name: "DbUserProfileId",
table: "UpdateRecords",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_UpdateRecords_DbUserProfileId",
table: "UpdateRecords",
column: "DbUserProfileId");
migrationBuilder.AddForeignKey(
name: "FK_UpdateRecords_UserProfiles_DbUserProfileId",
table: "UpdateRecords",
column: "DbUserProfileId",
principalTable: "UserProfiles",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UpdateRecords_UserProfiles_UpdatedByUserProfileId",
table: "UpdateRecords",
column: "UpdatedByUserProfileId",
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UpdateRecords_UserProfiles_DbUserProfileId",
table: "UpdateRecords");
migrationBuilder.DropForeignKey(
name: "FK_UpdateRecords_UserProfiles_UpdatedByUserProfileId",
table: "UpdateRecords");
migrationBuilder.DropIndex(
name: "IX_UpdateRecords_DbUserProfileId",
table: "UpdateRecords");
migrationBuilder.DropColumn(
name: "DbUserProfileId",
table: "UpdateRecords");
migrationBuilder.RenameColumn(
name: "UpdatedByUserProfileId",
table: "UpdateRecords",
newName: "UserProfileId");
migrationBuilder.RenameIndex(
name: "IX_UpdateRecords_UpdatedByUserProfileId",
table: "UpdateRecords",
newName: "IX_UpdateRecords_UserProfileId");
migrationBuilder.AddForeignKey(
name: "FK_UpdateRecords_UserProfiles_UserProfileId",
table: "UpdateRecords",
column: "UserProfileId",
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}