feature: In-App Simulation Runner (Backend)
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace VigilCareClinicalAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddSimulationSupport : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "is_simulated",
|
||||
table: "patients",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "simulation_runs",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
scenario_id = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
scenario_name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
||||
speed = table.Column<double>(type: "double precision", nullable: false),
|
||||
status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
patient_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
encounter_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
started_by_user_id = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
started_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
completed_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
observations_sent = table.Column<int>(type: "integer", nullable: false),
|
||||
medications_sent = table.Column<int>(type: "integer", nullable: false),
|
||||
orders_placed = table.Column<int>(type: "integer", nullable: false),
|
||||
last_offset_minutes = table.Column<double>(type: "double precision", nullable: false),
|
||||
total_offset_minutes = table.Column<double>(type: "double precision", nullable: false),
|
||||
failure_reason = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_simulation_runs", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Patients_IsSimulated",
|
||||
table: "patients",
|
||||
column: "is_simulated",
|
||||
filter: "is_simulated = true");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_simulation_runs_status_started_at",
|
||||
table: "simulation_runs",
|
||||
columns: new[] { "status", "started_at" },
|
||||
descending: new[] { false, true });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "simulation_runs");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Patients_IsSimulated",
|
||||
table: "patients");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "is_simulated",
|
||||
table: "patients");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user