新增车辆表及OTA权限与逻辑优化
新增车辆任务与报警表,完善实体与DbContext配置。细化OTA权限校验,增强回传会话IP安全。优化OTA上传与设置面板,调度器支持重启恢复。报警采集逻辑支持历史分段。
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MiGu.DB.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddFleetTables : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "cdm_tasks",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
||||
task_id = table.Column<string>(type: "TEXT", maxLength: 128, nullable: true),
|
||||
mission_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
mission_name = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false),
|
||||
mission_type = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false),
|
||||
src_site_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
src_label = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
||||
dst_site_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
dst_label = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
||||
status = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false),
|
||||
status_code = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false),
|
||||
car_id = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
car_name = table.Column<string>(type: "TEXT", maxLength: 128, nullable: true),
|
||||
priority = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
create_time = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
start_time = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
finish_time = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
stuck_reason = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true),
|
||||
overdue = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
first_seen_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
|
||||
last_seen_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_cdm_tasks", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "vehicle_alarms",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false),
|
||||
car_id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
car_name = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false),
|
||||
info = table.Column<string>(type: "text", nullable: false),
|
||||
level = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
status = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false),
|
||||
first_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
|
||||
last_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
|
||||
resolved_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
duration_secs = table.Column<long>(type: "INTEGER", nullable: true),
|
||||
acknowledged = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
acknowledged_at = table.Column<string>(type: "TEXT", maxLength: 40, nullable: true),
|
||||
acknowledged_by = table.Column<string>(type: "TEXT", maxLength: 128, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_vehicle_alarms", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_cdm_tasks_create_time",
|
||||
table: "cdm_tasks",
|
||||
column: "create_time");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_cdm_tasks_status_code",
|
||||
table: "cdm_tasks",
|
||||
column: "status_code");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_vehicle_alarms_car_id_status",
|
||||
table: "vehicle_alarms",
|
||||
columns: new[] { "car_id", "status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_vehicle_alarms_first_at",
|
||||
table: "vehicle_alarms",
|
||||
column: "first_at");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_vehicle_alarms_status",
|
||||
table: "vehicle_alarms",
|
||||
column: "status");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "cdm_tasks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "vehicle_alarms");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user