using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SmartAquaViewer.Migrations
{
    /// <inheritdoc />
    public partial class AddWaterQualityTable : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "WaterQuality");

            migrationBuilder.CreateTable(
                name: "water_quality",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    recorded_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    tank_number = table.Column<int>(type: "int", nullable: false),
                    tank_do_value = table.Column<double>(type: "double", nullable: false),
                    tank_ph = table.Column<double>(type: "double", nullable: false),
                    tank_orp = table.Column<double>(type: "double", nullable: false),
                    tank_temperature = table.Column<double>(type: "double", nullable: false),
                    tank_flow_rate = table.Column<double>(type: "double", nullable: false),
                    filter_sand_filter_power = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    filter_sump_ph = table.Column<double>(type: "double", nullable: false),
                    filter_sump_orp = table.Column<double>(type: "double", nullable: false),
                    filter_sump_water_level = table.Column<double>(type: "double", nullable: false),
                    filter_sump_flow_rate = table.Column<double>(type: "double", nullable: false),
                    filter_sump_temperature = table.Column<double>(type: "double", nullable: false),
                    filter_circulation_pump_power = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    filter_inverter_status = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    filter_flow_rate = table.Column<double>(type: "double", nullable: false),
                    filter_heat_pump_power = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    filter_heat_pump_temperature = table.Column<double>(type: "double", nullable: false),
                    filter_air_blower_power = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    ster_ozone_generator_power = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    ster_uv_sterilizer_id = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ster_uv_sterilizer_power = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    ster_ozone_dissolver_power = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    ster_ozone_dissolver_pressure = table.Column<double>(type: "double", nullable: false),
                    ster_excess_ozone_destroyer_power = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_water_quality", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "water_quality");

            migrationBuilder.CreateTable(
                name: "WaterQuality",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    DO = table.Column<double>(type: "double", nullable: false),
                    ElectricalConductivity = table.Column<double>(type: "double", nullable: false),
                    FlowRate = table.Column<double>(type: "double", nullable: false),
                    ORP = table.Column<double>(type: "double", nullable: false),
                    PH = table.Column<double>(type: "double", nullable: false),
                    Salinity = table.Column<double>(type: "double", nullable: false),
                    TSS = table.Column<double>(type: "double", nullable: false),
                    Temperature = table.Column<double>(type: "double", nullable: false),
                    Timestamp = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    TotalNitrogen = table.Column<double>(type: "double", nullable: false),
                    TotalPhosphorus = table.Column<double>(type: "double", nullable: false),
                    Turbidity = table.Column<double>(type: "double", nullable: false),
                    WaterLevel = table.Column<double>(type: "double", nullable: false),
                    WaterTankNum = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WaterQuality", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }
    }
}
