Initial commit
This commit is contained in:
@@ -0,0 +1,233 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RobotNet10.RobotApp.Data.Migrations.TuneDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddTunDb : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "parameter_sets",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
Description = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
IsDefault = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
Version = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
ControllerType = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
MovePidConfig = table.Column<string>(type: "TEXT", nullable: false),
|
||||
RotatePidConfig = table.Column<string>(type: "TEXT", nullable: false),
|
||||
PurePursuitConfig = table.Column<string>(type: "TEXT", nullable: false),
|
||||
StanleyConfig = table.Column<string>(type: "TEXT", nullable: false),
|
||||
EstimatorConfig = table.Column<string>(type: "TEXT", nullable: false),
|
||||
SignalConfig = table.Column<string>(type: "TEXT", nullable: false),
|
||||
MotorDynamicsConfig = table.Column<string>(type: "TEXT", nullable: false),
|
||||
NavigationConfig = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_parameter_sets", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "test_runs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
ScenarioId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
ParameterSetId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
StartTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
EndTime = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
Status = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Duration = table.Column<double>(type: "REAL", nullable: false),
|
||||
Notes = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true),
|
||||
ErrorMessage = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_test_runs", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "test_scenarios",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
Description = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
IsDefault = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
ConfigJson = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_test_scenarios", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "safety_violations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
TestRunId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Severity = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Value = table.Column<double>(type: "REAL", nullable: false),
|
||||
Threshold = table.Column<double>(type: "REAL", nullable: false),
|
||||
Message = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_safety_violations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_safety_violations_test_runs_TestRunId",
|
||||
column: x => x.TestRunId,
|
||||
principalTable: "test_runs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "test_metrics",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
TestRunId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
CrossTrackErrorRMS = table.Column<double>(type: "REAL", nullable: false),
|
||||
CrossTrackErrorPeak = table.Column<double>(type: "REAL", nullable: false),
|
||||
CrossTrackErrorMean = table.Column<double>(type: "REAL", nullable: false),
|
||||
CrossTrackErrorStdDev = table.Column<double>(type: "REAL", nullable: false),
|
||||
HeadingErrorRMS = table.Column<double>(type: "REAL", nullable: false),
|
||||
HeadingErrorPeak = table.Column<double>(type: "REAL", nullable: false),
|
||||
GoalPositionError = table.Column<double>(type: "REAL", nullable: false),
|
||||
GoalHeadingError = table.Column<double>(type: "REAL", nullable: false),
|
||||
VelocityStdDev = table.Column<double>(type: "REAL", nullable: false),
|
||||
AccelerationStdDev = table.Column<double>(type: "REAL", nullable: false),
|
||||
PathLengthRatio = table.Column<double>(type: "REAL", nullable: false),
|
||||
CompletionTime = table.Column<double>(type: "REAL", nullable: false),
|
||||
AverageSpeed = table.Column<double>(type: "REAL", nullable: false),
|
||||
MaxSpeed = table.Column<double>(type: "REAL", nullable: false),
|
||||
OverallScore = table.Column<double>(type: "REAL", nullable: false),
|
||||
TrackingScore = table.Column<double>(type: "REAL", nullable: false),
|
||||
SmoothnessScore = table.Column<double>(type: "REAL", nullable: false),
|
||||
EfficiencyScore = table.Column<double>(type: "REAL", nullable: false),
|
||||
PassedCriteria = table.Column<bool>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_test_metrics", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_test_metrics_test_runs_TestRunId",
|
||||
column: x => x.TestRunId,
|
||||
principalTable: "test_runs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_parameter_sets_CreatedAt",
|
||||
table: "parameter_sets",
|
||||
column: "CreatedAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_parameter_sets_IsDefault",
|
||||
table: "parameter_sets",
|
||||
column: "IsDefault");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_parameter_sets_Name",
|
||||
table: "parameter_sets",
|
||||
column: "Name");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_safety_violations_TestRunId",
|
||||
table: "safety_violations",
|
||||
column: "TestRunId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_safety_violations_TestRunId_Timestamp",
|
||||
table: "safety_violations",
|
||||
columns: new[] { "TestRunId", "Timestamp" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_safety_violations_Timestamp",
|
||||
table: "safety_violations",
|
||||
column: "Timestamp");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_metrics_TestRunId",
|
||||
table: "test_metrics",
|
||||
column: "TestRunId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_runs_ParameterSetId",
|
||||
table: "test_runs",
|
||||
column: "ParameterSetId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_runs_ScenarioId",
|
||||
table: "test_runs",
|
||||
column: "ScenarioId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_runs_ScenarioId_ParameterSetId",
|
||||
table: "test_runs",
|
||||
columns: new[] { "ScenarioId", "ParameterSetId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_runs_StartTime",
|
||||
table: "test_runs",
|
||||
column: "StartTime");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_runs_Status",
|
||||
table: "test_runs",
|
||||
column: "Status");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_scenarios_CreatedAt",
|
||||
table: "test_scenarios",
|
||||
column: "CreatedAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_scenarios_Name",
|
||||
table: "test_scenarios",
|
||||
column: "Name");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_test_scenarios_Type",
|
||||
table: "test_scenarios",
|
||||
column: "Type");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "parameter_sets");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "safety_violations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "test_metrics");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "test_scenarios");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "test_runs");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user