using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PARR.DAL.Migrations
{
    /// <inheritdoc />
    public partial class TblOrdersAndAgentHistory : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "DateModified",
                table: "Orders",
                type: "timestamp with time zone",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "ShortName",
                table: "Orders",
                type: "text",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<Guid>(
                name: "OrderId",
                table: "AgentHistories",
                type: "uuid",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_AgentHistories_OrderId",
                table: "AgentHistories",
                column: "OrderId");

            migrationBuilder.AddForeignKey(
                name: "FK_AgentHistories_Orders_OrderId",
                table: "AgentHistories",
                column: "OrderId",
                principalTable: "Orders",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_AgentHistories_OrderId",
                table: "AgentHistories");

            migrationBuilder.DropColumn(
                name: "DateModified",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "ShortName",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "OrderId",
                table: "AgentHistories");
        }
    }
}
