using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SimpleLIS.Migrations { /// public partial class Initialmigrations : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Messages", columns: table => new { MessageId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), ControlId = table.Column(type: "TEXT", nullable: false), MessageType = table.Column(type: "TEXT", nullable: false), SendingApp = table.Column(type: "TEXT", nullable: false), SendingFacility = table.Column(type: "TEXT", nullable: false), ReceivingApp = table.Column(type: "TEXT", nullable: false), ReceivingFacility = table.Column(type: "TEXT", nullable: false), Timestamp = table.Column(type: "TEXT", nullable: false), Version = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Messages", x => x.MessageId); }); migrationBuilder.CreateTable( name: "Patients", columns: table => new { PatientId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), HL7PatientId = table.Column(type: "TEXT", nullable: false), LastName = table.Column(type: "TEXT", nullable: false), FirstName = table.Column(type: "TEXT", nullable: false), DateOfBirth = table.Column(type: "TEXT", nullable: false), Gender = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Patients", x => x.PatientId); }); migrationBuilder.CreateTable( name: "Observations", columns: table => new { ObservationId = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), MessageId = table.Column(type: "INTEGER", nullable: false), ObservationCode = table.Column(type: "TEXT", nullable: false), ObservationValue = table.Column(type: "TEXT", nullable: false), Units = table.Column(type: "TEXT", nullable: false), AbnormalFlag = table.Column(type: "TEXT", nullable: false), ResultStatus = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Observations"); migrationBuilder.DropTable( name: "Patients"); migrationBuilder.DropTable( name: "Messages"); } } }