using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace MiGu.DB.Migrations.Sqlite { /// public partial class AddFleetTables : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "cdm_tasks", columns: table => new { id = table.Column(type: "TEXT", maxLength: 64, nullable: false), task_id = table.Column(type: "TEXT", maxLength: 128, nullable: true), mission_id = table.Column(type: "INTEGER", nullable: false), mission_name = table.Column(type: "TEXT", maxLength: 128, nullable: false), mission_type = table.Column(type: "TEXT", maxLength: 128, nullable: false), src_site_id = table.Column(type: "INTEGER", nullable: false), src_label = table.Column(type: "TEXT", maxLength: 256, nullable: false), dst_site_id = table.Column(type: "INTEGER", nullable: false), dst_label = table.Column(type: "TEXT", maxLength: 256, nullable: false), status = table.Column(type: "TEXT", maxLength: 32, nullable: false), status_code = table.Column(type: "TEXT", maxLength: 32, nullable: false), car_id = table.Column(type: "INTEGER", nullable: true), car_name = table.Column(type: "TEXT", maxLength: 128, nullable: true), priority = table.Column(type: "INTEGER", nullable: false), create_time = table.Column(type: "TEXT", maxLength: 40, nullable: true), start_time = table.Column(type: "TEXT", maxLength: 40, nullable: true), finish_time = table.Column(type: "TEXT", maxLength: 40, nullable: true), stuck_reason = table.Column(type: "TEXT", maxLength: 512, nullable: true), overdue = table.Column(type: "INTEGER", nullable: false), first_seen_at = table.Column(type: "TEXT", maxLength: 40, nullable: false), last_seen_at = table.Column(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(type: "TEXT", maxLength: 36, nullable: false), car_id = table.Column(type: "INTEGER", nullable: false), car_name = table.Column(type: "TEXT", maxLength: 128, nullable: false), info = table.Column(type: "text", nullable: false), level = table.Column(type: "INTEGER", nullable: false), status = table.Column(type: "TEXT", maxLength: 16, nullable: false), first_at = table.Column(type: "TEXT", maxLength: 40, nullable: false), last_at = table.Column(type: "TEXT", maxLength: 40, nullable: false), resolved_at = table.Column(type: "TEXT", maxLength: 40, nullable: true), duration_secs = table.Column(type: "INTEGER", nullable: true), acknowledged = table.Column(type: "INTEGER", nullable: false), acknowledged_at = table.Column(type: "TEXT", maxLength: 40, nullable: true), acknowledged_by = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "cdm_tasks"); migrationBuilder.DropTable( name: "vehicle_alarms"); } } }