171 lines
7.4 KiB
C#
171 lines
7.4 KiB
C#
|
|
using System;
|
|||
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|||
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|
|||
|
|
#nullable disable
|
|||
|
|
|
|||
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|||
|
|
|
|||
|
|
namespace Cowain.TestProject.Migrations
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
public partial class baking_model : Migration
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "battery_info",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|||
|
|
Code = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|||
|
|
PalletId = table.Column<int>(type: "int", nullable: false),
|
|||
|
|
IsWaterBattery = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|||
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|||
|
|
ScanTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_battery_info", x => x.Id);
|
|||
|
|
})
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "pallet_info",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|||
|
|
Code = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|||
|
|
PalletStatus = table.Column<int>(type: "int", nullable: false),
|
|||
|
|
StationId = table.Column<int>(type: "int", nullable: false),
|
|||
|
|
LoadingStartTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|||
|
|
LoadingEndTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|||
|
|
BakingStartTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|||
|
|
BakingEndTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|||
|
|
UnLoadingTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|||
|
|
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|||
|
|
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|||
|
|
WaterValue = table.Column<double>(type: "double", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_pallet_info", x => x.Id);
|
|||
|
|
})
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "pallet_status",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|||
|
|
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|||
|
|
Desc = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false)
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_pallet_status", x => x.Id);
|
|||
|
|
})
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "station_info",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|||
|
|
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|||
|
|
LayOutX = table.Column<int>(type: "int", nullable: false),
|
|||
|
|
LayOutY = table.Column<int>(type: "int", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_station_info", x => x.Id);
|
|||
|
|
})
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "pallet_info_history",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
|
},
|
|||
|
|
constraints: table =>
|
|||
|
|
{
|
|||
|
|
table.PrimaryKey("PK_pallet_info_history", x => x.Id);
|
|||
|
|
table.ForeignKey(
|
|||
|
|
name: "FK_pallet_info_history_pallet_info_Id",
|
|||
|
|
column: x => x.Id,
|
|||
|
|
principalTable: "pallet_info",
|
|||
|
|
principalColumn: "Id",
|
|||
|
|
onDelete: ReferentialAction.Cascade);
|
|||
|
|
})
|
|||
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|||
|
|
|
|||
|
|
migrationBuilder.InsertData(
|
|||
|
|
table: "pallet_status",
|
|||
|
|
columns: new[] { "Id", "Desc", "Name" },
|
|||
|
|
values: new object[,]
|
|||
|
|
{
|
|||
|
|
{ 1, "新托盘", "New" },
|
|||
|
|
{ 2, "上料中", "Loading" }
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
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));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "battery_info");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "pallet_info_history");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "pallet_status");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "station_info");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "pallet_info");
|
|||
|
|
|
|||
|
|
migrationBuilder.UpdateData(
|
|||
|
|
table: "user",
|
|||
|
|
keyColumn: "Id",
|
|||
|
|
keyValue: 1,
|
|||
|
|
column: "CreateTime",
|
|||
|
|
value: new DateTime(2026, 1, 22, 14, 52, 24, 945, DateTimeKind.Local).AddTicks(547));
|
|||
|
|
|
|||
|
|
migrationBuilder.UpdateData(
|
|||
|
|
table: "user_role",
|
|||
|
|
keyColumn: "Id",
|
|||
|
|
keyValue: 1,
|
|||
|
|
column: "CreateTime",
|
|||
|
|
value: new DateTime(2026, 1, 22, 14, 52, 24, 949, DateTimeKind.Local).AddTicks(9102));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|