71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CocktailWeb.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class CreateFillerTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "Pos",
|
|
table: "Flaschen");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Fillers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Pos = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
|
FlascheId = table.Column<int>(type: "INTEGER", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Fillers", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Fillers_Flaschen_FlascheId",
|
|
column: x => x.FlascheId,
|
|
principalTable: "Flaschen",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Fillers_FlascheId",
|
|
table: "Fillers",
|
|
column: "FlascheId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Fillers");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "Pos",
|
|
table: "Flaschen",
|
|
type: "INTEGER",
|
|
nullable: true);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Flaschen",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "Pos",
|
|
value: null);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Flaschen",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "Pos",
|
|
value: null);
|
|
}
|
|
}
|
|
}
|