continuity/Server/DB/Migrations/20231108143729_AddInventoryToCharacter.cs

58 lines
2.3 KiB
C#
Raw Normal View History

2023-11-20 18:58:30 +00:00
// // Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Server.DB.Migrations;
/// <inheritdoc />
public partial class AddInventoryToCharacter : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InventoryItem",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CharacterId = table.Column<Guid>(type: "uuid", nullable: false),
ItemId = table.Column<short>(type: "smallint", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
Slot = table.Column<byte>(type: "smallint", nullable: false),
ItemType = table.Column<byte>(type: "smallint", nullable: false),
Level = table.Column<byte>(type: "smallint", nullable: false),
Rarity = table.Column<byte>(type: "smallint", nullable: false),
AddOption = table.Column<byte>(type: "smallint", nullable: false),
AddOption2 = table.Column<byte>(type: "smallint", nullable: false),
AddOption3 = table.Column<byte>(type: "smallint", nullable: false),
Option = table.Column<short>(type: "smallint", nullable: false),
Option2 = table.Column<short>(type: "smallint", nullable: false),
Option3 = table.Column<short>(type: "smallint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InventoryItem", x => x.Id);
table.ForeignKey(
name: "FK_InventoryItem_Characters_CharacterId",
column: x => x.CharacterId,
principalTable: "Characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_InventoryItem_CharacterId",
table: "InventoryItem",
column: "CharacterId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InventoryItem");
}
}