using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ZB.MOM.WW.OtOpcUa.Configuration.Migrations
{
    /// <inheritdoc />
    public partial class AddDriverInstanceResilienceConfig : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "ResilienceConfig",
                table: "DriverInstance",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddCheckConstraint(
                name: "CK_DriverInstance_ResilienceConfig_IsJson",
                table: "DriverInstance",
                sql: "ResilienceConfig IS NULL OR ISJSON(ResilienceConfig) = 1");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_DriverInstance_ResilienceConfig_IsJson",
                table: "DriverInstance");

            migrationBuilder.DropColumn(
                name: "ResilienceConfig",
                table: "DriverInstance");
        }
    }
}
