feature: Medication Tracking & Vital Sign Correlation
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace VigilCareClinicalAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddMedicationAdministrationsTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "medication_administrations",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
encounter_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
drug_name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
||||
dose = table.Column<decimal>(type: "numeric(10,4)", precision: 10, scale: 4, nullable: false),
|
||||
dose_unit = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
route = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
administered_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
administered_by = table.Column<string>(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" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "medication_administrations");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user