using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PARR.DAL.Migrations
{
    /// <inheritdoc />
    public partial class TblAppInWorksUpdNextLastRun : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "ScheduleGenerationTime",
                table: "ApplicationsInWorks");

            migrationBuilder.DropColumn(
                name: "ScheduleStartDate",
                table: "ApplicationsInWorks");

            migrationBuilder.AddColumn<string>(
                name: "AgentName",
                table: "ApplicationsInWorks",
                type: "text",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "AgentScript",
                table: "ApplicationsInWorks",
                type: "text",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IsAgent",
                table: "ApplicationsInWorks",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "LastRun",
                table: "ApplicationsInWorks",
                type: "timestamp with time zone",
                nullable: true);

            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "NextRun",
                table: "ApplicationsInWorks",
                type: "timestamp with time zone",
                nullable: false,
                defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)));
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "AgentName",
                table: "ApplicationsInWorks");

            migrationBuilder.DropColumn(
                name: "AgentScript",
                table: "ApplicationsInWorks");

            migrationBuilder.DropColumn(
                name: "IsAgent",
                table: "ApplicationsInWorks");

            migrationBuilder.DropColumn(
                name: "LastRun",
                table: "ApplicationsInWorks");

            migrationBuilder.DropColumn(
                name: "NextRun",
                table: "ApplicationsInWorks");

            migrationBuilder.AddColumn<TimeSpan>(
                name: "ScheduleGenerationTime",
                table: "ApplicationsInWorks",
                type: "interval",
                nullable: false,
                defaultValue: new TimeSpan(0, 0, 0, 0, 0));

            migrationBuilder.AddColumn<DateOnly>(
                name: "ScheduleStartDate",
                table: "ApplicationsInWorks",
                type: "date",
                nullable: false,
                defaultValue: new DateOnly(1, 1, 1));
        }
    }
}
