using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VigilCareClinicalAPI.Migrations { /// public partial class AddMedicationAdministrationsTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "medication_administrations", columns: table => new { id = table.Column(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"), encounter_id = table.Column(type: "uuid", nullable: false), drug_name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), dose = table.Column(type: "numeric(10,4)", precision: 10, scale: 4, nullable: false), dose_unit = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), route = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), administered_at = table.Column(type: "timestamp with time zone", nullable: false), administered_by = table.Column(type: "character varying(100)", maxLength: 100, nullable: false) }, constraints: table => { table.PrimaryKey("PK_medication_administrations", x => x.id); table.ForeignKey( name: "FK_medication_administrations_encounters_encounter_id", column: x => x.encounter_id, principalTable: "encounters", principalColumn: "id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_medication_administrations_encounter_id_administered_at", table: "medication_administrations", columns: new[] { "encounter_id", "administered_at" }); migrationBuilder.CreateIndex( name: "IX_medication_administrations_encounter_id_drug_name", table: "medication_administrations", columns: new[] { "encounter_id", "drug_name" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "medication_administrations"); } } }