80 lines
3.0 KiB
C#
80 lines
3.0 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace ThAmCo.Catering.Migrations
|
|
{
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.EnsureSchema(
|
|
name: "thamco.catering");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Menus",
|
|
schema: "thamco.catering",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(nullable: false)
|
|
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
|
Items = table.Column<string>(nullable: true),
|
|
Price = table.Column<double>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Menus", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "FoodBookings",
|
|
schema: "thamco.catering",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(nullable: false),
|
|
MenuId = table.Column<int>(nullable: false),
|
|
Notes = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_FoodBookings", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_FoodBookings_Menus_Id",
|
|
column: x => x.Id,
|
|
principalSchema: "thamco.catering",
|
|
principalTable: "Menus",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
schema: "thamco.catering",
|
|
table: "Menus",
|
|
columns: new[] { "Id", "Items", "Price" },
|
|
values: new object[] { 1, "Chicken Pate, Chicken Roast, Chicken Cake", 8.5 });
|
|
|
|
migrationBuilder.InsertData(
|
|
schema: "thamco.catering",
|
|
table: "Menus",
|
|
columns: new[] { "Id", "Items", "Price" },
|
|
values: new object[] { 2, "Toast, Cheese On Toast, Jam on Toast", 7.5 });
|
|
|
|
migrationBuilder.InsertData(
|
|
schema: "thamco.catering",
|
|
table: "Menus",
|
|
columns: new[] { "Id", "Items", "Price" },
|
|
values: new object[] { 3, "Mac and Cheese, Alan's Special, Cheesecake", 9.0 });
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "FoodBookings",
|
|
schema: "thamco.catering");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Menus",
|
|
schema: "thamco.catering");
|
|
}
|
|
}
|
|
}
|