using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace ReallifeGamemode.Database.Migrations
{
  public partial class FactionWeapons : Migration
  {
    protected override void Up(MigrationBuilder migrationBuilder)
    {
      migrationBuilder.CreateTable(
          name: "FactionWeapons",
          columns: table => new
          {
            Id = table.Column<int>(nullable: false)
                  .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
            FactionId = table.Column<int>(nullable: false),
            WeaponModel = table.Column<string>(nullable: true),
            SlotID = table.Column<int>(nullable: false),
            Rank = table.Column<int>(nullable: false)
          },
          constraints: table =>
          {
            table.PrimaryKey("PK_FactionWeapons", x => x.Id);
            table.ForeignKey(
                      name: "FK_FactionWeapons_Factions_FactionId",
                      column: x => x.FactionId,
                      principalTable: "Factions",
                      principalColumn: "Id",
                      onDelete: ReferentialAction.Cascade);
          });

      migrationBuilder.CreateIndex(
          name: "IX_FactionWeapons_FactionId",
          table: "FactionWeapons",
          column: "FactionId");
    }

    protected override void Down(MigrationBuilder migrationBuilder)
    {
      migrationBuilder.DropTable(
          name: "FactionWeapons");
    }
  }
}
