using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VigilCareClinicalAPI.Migrations { /// public partial class AddQsofaEvaluations : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "qsofa_evaluations", columns: table => new { id = table.Column(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"), encounter_id = table.Column(type: "uuid", nullable: false), patient_id = table.Column(type: "uuid", nullable: false), active_criteria = table.Column(type: "integer", nullable: false), resp_rate = table.Column(type: "numeric", nullable: true), systolic_bp = table.Column(type: "numeric", nullable: true), avpu = table.Column(type: "numeric", nullable: true), screen_alert_fired = table.Column(type: "boolean", nullable: false), evaluated_at = table.Column(type: "timestamp with time zone", nullable: false), created_at = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_qsofa_evaluations", x => x.id); table.CheckConstraint("chk_qsofa_evaluations_active_criteria", "active_criteria >= 0 AND active_criteria <= 3"); table.ForeignKey( name: "FK_qsofa_evaluations_encounters_encounter_id", column: x => x.encounter_id, principalTable: "encounters", principalColumn: "id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_qsofa_evaluations_encounter_id_evaluated_at", table: "qsofa_evaluations", columns: new[] { "encounter_id", "evaluated_at" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "qsofa_evaluations"); } } }