94 lines
3.3 KiB
C#
94 lines
3.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace RLHF.Generator.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.EnsureSchema(
|
|
name: "dbo");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Category",
|
|
schema: "dbo",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false),
|
|
Name = table.Column<string>(type: "nvarchar(128)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Category", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TrainingItem",
|
|
schema: "dbo",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
CategoryId = table.Column<int>(type: "int", nullable: false),
|
|
IsPositive = table.Column<bool>(type: "bit", nullable: false),
|
|
Value = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TrainingItem", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_TrainingItem_Category_CategoryId",
|
|
column: x => x.CategoryId,
|
|
principalSchema: "dbo",
|
|
principalTable: "Category",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
schema: "dbo",
|
|
table: "Category",
|
|
columns: new[] { "Id", "Name" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "MEDICAL_ALLERGY" },
|
|
{ 2, "MEDICAL_DIAGNOSIS" },
|
|
{ 3, "MEDICAL_FAMILY_HISTORY" },
|
|
{ 4, "MEDICAL_MEDICATION" },
|
|
{ 5, "MEDICAL_MENTAL_HEALTH" },
|
|
{ 6, "MEDICAL_OTHER" },
|
|
{ 7, "MEDICAL_PHYSICAL_HEALTH" },
|
|
{ 8, "MEDICAL_PROCEDURE" },
|
|
{ 9, "MEDICAL_SUBSTANCE_USE" },
|
|
{ 10, "MEDICAL_SYMPTOM" },
|
|
{ 11, "MEDICAL_TEST" },
|
|
{ 12, "MEDICAL_TREATMENT" }
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TrainingItem_CategoryId",
|
|
schema: "dbo",
|
|
table: "TrainingItem",
|
|
column: "CategoryId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "TrainingItem",
|
|
schema: "dbo");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Category",
|
|
schema: "dbo");
|
|
}
|
|
}
|
|
}
|