using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VigilCareClinicalAPI.Migrations { /// public partial class AddNews2ScoresTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "news2_scores", 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), total_score = table.Column(type: "integer", nullable: false), risk_level = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), resp_rate_score = table.Column(type: "integer", nullable: false), spo2_score = table.Column(type: "integer", nullable: false), systolic_bp_score = table.Column(type: "integer", nullable: false), heart_rate_score = table.Column(type: "integer", nullable: false), consciousness_score = table.Column(type: "integer", nullable: false), temperature_score = table.Column(type: "integer", nullable: false), supplemental_o2_score = table.Column(type: "integer", nullable: false), has_single_param_three = table.Column(type: "boolean", nullable: false), calculated_at = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_news2_scores", x => x.id); table.CheckConstraint("chk_news2_scores_risk_level", "risk_level IN ('LOW', 'LOW_MEDIUM', 'MEDIUM', 'HIGH')"); table.ForeignKey( name: "FK_news2_scores_encounters_encounter_id", column: x => x.encounter_id, principalTable: "encounters", principalColumn: "id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_news2_scores_encounter_id_calculated_at", table: "news2_scores", columns: new[] { "encounter_id", "calculated_at" }); migrationBuilder.CreateIndex( name: "IX_news2_scores_patient_id_calculated_at", table: "news2_scores", columns: new[] { "patient_id", "calculated_at" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "news2_scores"); } } }