using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VigilCareClinicalAPI.Migrations { /// public partial class AddSimulationSupport : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "is_simulated", table: "patients", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "simulation_runs", columns: table => new { id = table.Column(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"), scenario_id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), scenario_name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), speed = table.Column(type: "double precision", nullable: false), status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), patient_id = table.Column(type: "uuid", nullable: true), encounter_id = table.Column(type: "uuid", nullable: true), started_by_user_id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), started_at = table.Column(type: "timestamp with time zone", nullable: false), completed_at = table.Column(type: "timestamp with time zone", nullable: true), observations_sent = table.Column(type: "integer", nullable: false), medications_sent = table.Column(type: "integer", nullable: false), orders_placed = table.Column(type: "integer", nullable: false), last_offset_minutes = table.Column(type: "double precision", nullable: false), total_offset_minutes = table.Column(type: "double precision", nullable: false), failure_reason = table.Column(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 }); } /// 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"); } } }