using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Cowain.TestProject.Migrations
{
///
public partial class baking_model_edit : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_pallet_info_history_pallet_info_Id",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "CreateTime",
table: "pallet_info");
migrationBuilder.AlterColumn(
name: "Id",
table: "pallet_info_history",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AddColumn(
name: "BakingEndTime",
table: "pallet_info_history",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn(
name: "BakingStartTime",
table: "pallet_info_history",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn(
name: "Code",
table: "pallet_info_history",
type: "varchar(200)",
maxLength: 200,
nullable: false,
defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn(
name: "HistoryTime",
table: "pallet_info_history",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn(
name: "LoadingEndTime",
table: "pallet_info_history",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn(
name: "LoadingStartTime",
table: "pallet_info_history",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn(
name: "PalletStatus",
table: "pallet_info_history",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn(
name: "StationId",
table: "pallet_info_history",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn(
name: "UnLoadingTime",
table: "pallet_info_history",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn(
name: "UpdateTime",
table: "pallet_info_history",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn(
name: "WaterValue",
table: "pallet_info_history",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn(
name: "BindingId",
table: "pallet_info",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn(
name: "WaterValue",
table: "battery_info",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.CreateTable(
name: "baking_info",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
BindingId = table.Column(type: "int", nullable: false),
TagId = table.Column(type: "int", nullable: false),
DataValue = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreateTime = table.Column(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_baking_info", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "baking_variable",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
StationId = table.Column(type: "int", nullable: false),
TagId = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_baking_variable", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "pallet_binding",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
PalletId = table.Column(type: "int", nullable: false),
CreateTime = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_pallet_binding", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "user",
keyColumn: "Id",
keyValue: 1,
column: "CreateTime",
value: new DateTime(2026, 1, 26, 11, 25, 51, 148, DateTimeKind.Local).AddTicks(7643));
migrationBuilder.UpdateData(
table: "user_role",
keyColumn: "Id",
keyValue: 1,
column: "CreateTime",
value: new DateTime(2026, 1, 26, 11, 25, 51, 165, DateTimeKind.Local).AddTicks(2827));
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "baking_info");
migrationBuilder.DropTable(
name: "baking_variable");
migrationBuilder.DropTable(
name: "pallet_binding");
migrationBuilder.DropColumn(
name: "BakingEndTime",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "BakingStartTime",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "Code",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "HistoryTime",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "LoadingEndTime",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "LoadingStartTime",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "PalletStatus",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "StationId",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "UnLoadingTime",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "UpdateTime",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "WaterValue",
table: "pallet_info_history");
migrationBuilder.DropColumn(
name: "BindingId",
table: "pallet_info");
migrationBuilder.DropColumn(
name: "WaterValue",
table: "battery_info");
migrationBuilder.AlterColumn(
name: "Id",
table: "pallet_info_history",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AddColumn(
name: "CreateTime",
table: "pallet_info",
type: "datetime(6)",
nullable: true);
migrationBuilder.UpdateData(
table: "user",
keyColumn: "Id",
keyValue: 1,
column: "CreateTime",
value: new DateTime(2026, 1, 24, 16, 23, 11, 270, DateTimeKind.Local).AddTicks(5712));
migrationBuilder.UpdateData(
table: "user_role",
keyColumn: "Id",
keyValue: 1,
column: "CreateTime",
value: new DateTime(2026, 1, 24, 16, 23, 11, 280, DateTimeKind.Local).AddTicks(5323));
migrationBuilder.AddForeignKey(
name: "FK_pallet_info_history_pallet_info_Id",
table: "pallet_info_history",
column: "Id",
principalTable: "pallet_info",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}