using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CocktailWeb.Migrations
{
///
public partial class CreateCocktailTable : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Cocktails",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Cocktails", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CocktailFlaschen",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CocktailID = table.Column(type: "INTEGER", nullable: false),
FlascheID = table.Column(type: "INTEGER", nullable: false),
Reihenfolge = table.Column(type: "INTEGER", nullable: false),
Menge = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CocktailFlaschen", x => x.Id);
table.ForeignKey(
name: "FK_CocktailFlaschen_Cocktails_CocktailID",
column: x => x.CocktailID,
principalTable: "Cocktails",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CocktailFlaschen_Flaschen_FlascheID",
column: x => x.FlascheID,
principalTable: "Flaschen",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CocktailFlaschen_CocktailID",
table: "CocktailFlaschen",
column: "CocktailID");
migrationBuilder.CreateIndex(
name: "IX_CocktailFlaschen_FlascheID",
table: "CocktailFlaschen",
column: "FlascheID");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CocktailFlaschen");
migrationBuilder.DropTable(
name: "Cocktails");
}
}
}