drinkrate/DrinkRateAPI/Migrations/20250812055359_HistoryUpdatedByField.cs
2025-08-12 07:57:17 +02:00

93 lines
3.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DrinkRateAPI.Migrations
{
/// <inheritdoc />
public partial class HistoryUpdatedByField : Migration
{
/// <inheritdoc />
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<Guid>(
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);
}
/// <inheritdoc />
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);
}
}
}