using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace WarehouseAppSHIPS.Migrations
{
    /// <inheritdoc />
    public partial class UpdateKolomInbound : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_InboundTransactions_AppUsers_UserId",
                table: "InboundTransactions");

            migrationBuilder.RenameColumn(
                name: "UserId",
                table: "InboundTransactions",
                newName: "ReceiverId");

            migrationBuilder.RenameIndex(
                name: "IX_InboundTransactions_UserId",
                table: "InboundTransactions",
                newName: "IX_InboundTransactions_ReceiverId");

            migrationBuilder.AddColumn<string>(
                name: "Remarks",
                table: "InboundTransactions",
                type: "nvarchar(255)",
                maxLength: 255,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "SupplierName",
                table: "InboundTransactions",
                type: "nvarchar(255)",
                maxLength: 255,
                nullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_InboundTransactions_AppUsers_ReceiverId",
                table: "InboundTransactions",
                column: "ReceiverId",
                principalTable: "AppUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_InboundTransactions_AppUsers_ReceiverId",
                table: "InboundTransactions");

            migrationBuilder.DropColumn(
                name: "Remarks",
                table: "InboundTransactions");

            migrationBuilder.DropColumn(
                name: "SupplierName",
                table: "InboundTransactions");

            migrationBuilder.RenameColumn(
                name: "ReceiverId",
                table: "InboundTransactions",
                newName: "UserId");

            migrationBuilder.RenameIndex(
                name: "IX_InboundTransactions_ReceiverId",
                table: "InboundTransactions",
                newName: "IX_InboundTransactions_UserId");

            migrationBuilder.AddForeignKey(
                name: "FK_InboundTransactions_AppUsers_UserId",
                table: "InboundTransactions",
                column: "UserId",
                principalTable: "AppUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
