95 lines
4.1 KiB
C#
95 lines
4.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SimpleLIS.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Initialmigrations : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Messages",
|
|
columns: table => new
|
|
{
|
|
MessageId = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
ControlId = table.Column<string>(type: "TEXT", nullable: false),
|
|
MessageType = table.Column<string>(type: "TEXT", nullable: false),
|
|
SendingApp = table.Column<string>(type: "TEXT", nullable: false),
|
|
SendingFacility = table.Column<string>(type: "TEXT", nullable: false),
|
|
ReceivingApp = table.Column<string>(type: "TEXT", nullable: false),
|
|
ReceivingFacility = table.Column<string>(type: "TEXT", nullable: false),
|
|
Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
Version = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Messages", x => x.MessageId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Patients",
|
|
columns: table => new
|
|
{
|
|
PatientId = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
HL7PatientId = table.Column<string>(type: "TEXT", nullable: false),
|
|
LastName = table.Column<string>(type: "TEXT", nullable: false),
|
|
FirstName = table.Column<string>(type: "TEXT", nullable: false),
|
|
DateOfBirth = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
Gender = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Patients", x => x.PatientId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Observations",
|
|
columns: table => new
|
|
{
|
|
ObservationId = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
MessageId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
ObservationCode = table.Column<string>(type: "TEXT", nullable: false),
|
|
ObservationValue = table.Column<string>(type: "TEXT", nullable: false),
|
|
Units = table.Column<string>(type: "TEXT", nullable: false),
|
|
AbnormalFlag = table.Column<string>(type: "TEXT", nullable: false),
|
|
ResultStatus = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Observations", x => x.ObservationId);
|
|
table.ForeignKey(
|
|
name: "FK_Observations_Messages_MessageId",
|
|
column: x => x.MessageId,
|
|
principalTable: "Messages",
|
|
principalColumn: "MessageId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Observations_MessageId",
|
|
table: "Observations",
|
|
column: "MessageId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Observations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Patients");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Messages");
|
|
}
|
|
}
|
|
}
|