124 lines
4.8 KiB
C#
124 lines
4.8 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
namespace SessionCompanion.Database.Migrations
|
|||
|
{
|
|||
|
public partial class shopkepe : Migration
|
|||
|
{
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Shopkeepers",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|||
|
IsAvailable = table.Column<bool>(type: "bit", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Shopkeepers", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "ShopkeeperItems",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|||
|
ShopkeeperId = table.Column<int>(type: "int", nullable: false),
|
|||
|
ArmorId = table.Column<int>(type: "int", nullable: true),
|
|||
|
WeaponId = table.Column<int>(type: "int", nullable: true)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_ShopkeeperItems", x => x.Id);
|
|||
|
table.ForeignKey(
|
|||
|
name: "FK_ShopkeeperItems_Armors_ArmorId",
|
|||
|
column: x => x.ArmorId,
|
|||
|
principalTable: "Armors",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Restrict);
|
|||
|
table.ForeignKey(
|
|||
|
name: "FK_ShopkeeperItems_Shopkeepers_ShopkeeperId",
|
|||
|
column: x => x.ShopkeeperId,
|
|||
|
principalTable: "Shopkeepers",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
table.ForeignKey(
|
|||
|
name: "FK_ShopkeeperItems_Weapons_WeaponId",
|
|||
|
column: x => x.WeaponId,
|
|||
|
principalTable: "Weapons",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Restrict);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.InsertData(
|
|||
|
table: "Shopkeepers",
|
|||
|
columns: new[] { "Id", "IsAvailable", "Name" },
|
|||
|
values: new object[,]
|
|||
|
{
|
|||
|
{ 1, true, "Swędzioch" },
|
|||
|
{ 2, false, "Lucius Prawowity" },
|
|||
|
{ 3, true, "Bohr Twarda Zbroja" },
|
|||
|
{ 4, false, "Skwarczyk Podobny" },
|
|||
|
{ 5, true, "Zielony spod Gruszkowego Lasu" },
|
|||
|
{ 6, false, "Zmarniały" }
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.InsertData(
|
|||
|
table: "ShopkeeperItems",
|
|||
|
columns: new[] { "Id", "ArmorId", "ShopkeeperId", "WeaponId" },
|
|||
|
values: new object[,]
|
|||
|
{
|
|||
|
{ 1, 2, 1, null },
|
|||
|
{ 20, 13, 6, null },
|
|||
|
{ 19, 2, 6, null },
|
|||
|
{ 18, 7, 5, null },
|
|||
|
{ 17, 9, 5, null },
|
|||
|
{ 16, 6, 5, null },
|
|||
|
{ 15, 11, 4, null },
|
|||
|
{ 14, null, 4, 14 },
|
|||
|
{ 13, null, 4, 24 },
|
|||
|
{ 12, null, 4, 1 },
|
|||
|
{ 11, null, 3, 7 },
|
|||
|
{ 10, 8, 3, null },
|
|||
|
{ 9, 1, 3, null },
|
|||
|
{ 8, null, 2, 14 },
|
|||
|
{ 7, null, 2, 25 },
|
|||
|
{ 6, null, 2, 3 },
|
|||
|
{ 5, 12, 1, null },
|
|||
|
{ 4, null, 1, 17 },
|
|||
|
{ 3, 10, 1, null },
|
|||
|
{ 2, null, 1, 33 },
|
|||
|
{ 21, 10, 6, null },
|
|||
|
{ 22, null, 6, 37 }
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_ShopkeeperItems_ArmorId",
|
|||
|
table: "ShopkeeperItems",
|
|||
|
column: "ArmorId");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_ShopkeeperItems_ShopkeeperId",
|
|||
|
table: "ShopkeeperItems",
|
|||
|
column: "ShopkeeperId");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_ShopkeeperItems_WeaponId",
|
|||
|
table: "ShopkeeperItems",
|
|||
|
column: "WeaponId");
|
|||
|
}
|
|||
|
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "ShopkeeperItems");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Shopkeepers");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|