Start on dockerization
Edited freezerDto a tad
This commit is contained in:
103
Migrations/20230406151852_InitialDb.cs
Normal file
103
Migrations/20230406151852_InitialDb.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace ThuisApi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialDb : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cards",
|
||||
columns: table => new
|
||||
{
|
||||
CardId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Issuer = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Code = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cards", x => x.CardId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Freezer",
|
||||
columns: table => new
|
||||
{
|
||||
FreezerId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Freezer", x => x.FreezerId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "FreezerItem",
|
||||
columns: table => new
|
||||
{
|
||||
FreezerItemId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Item = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Amount = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Drawer = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
DatePlacedInFreezer = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
FreezerId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_FreezerItem", x => x.FreezerItemId);
|
||||
table.ForeignKey(
|
||||
name: "FK_FreezerItem_Freezer_FreezerId",
|
||||
column: x => x.FreezerId,
|
||||
principalTable: "Freezer",
|
||||
principalColumn: "FreezerId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Freezer",
|
||||
columns: new[] { "FreezerId", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "Keuken" },
|
||||
{ 2, "Berging" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "FreezerItem",
|
||||
columns: new[] { "FreezerItemId", "Amount", "DatePlacedInFreezer", "Drawer", "FreezerId", "Item" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 1, "Kip" },
|
||||
{ 2, 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 2, 2, "1 pak van 2 hamburgers" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FreezerItem_FreezerId",
|
||||
table: "FreezerItem",
|
||||
column: "FreezerId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cards");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "FreezerItem");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Freezer");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user