You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
171 lines
6.2 KiB
171 lines
6.2 KiB
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace EntityFramwork.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class final : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Skins_Champions_ChampionForeignKey",
|
|
table: "Skins");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "ChampionForeignKey",
|
|
table: "Skins",
|
|
newName: "ChampionId");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_Skins_ChampionForeignKey",
|
|
table: "Skins",
|
|
newName: "IX_Skins_ChampionId");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Family",
|
|
table: "Runes",
|
|
type: "TEXT",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Classe",
|
|
table: "Champions",
|
|
type: "TEXT",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "EntityPageRune",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_EntityPageRune", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Skills",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
Description = table.Column<string>(type: "TEXT", nullable: false),
|
|
Type = table.Column<string>(type: "TEXT", nullable: false),
|
|
ChampionId = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Skills", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Skills_Champions_ChampionId",
|
|
column: x => x.ChampionId,
|
|
principalTable: "Champions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "EntityCategorieRune",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Category = table.Column<string>(type: "TEXT", nullable: false),
|
|
IdPageRune = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IdRune = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_EntityCategorieRune", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_EntityCategorieRune_EntityPageRune_IdPageRune",
|
|
column: x => x.IdPageRune,
|
|
principalTable: "EntityPageRune",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_EntityCategorieRune_Runes_IdRune",
|
|
column: x => x.IdRune,
|
|
principalTable: "Runes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EntityCategorieRune_IdPageRune",
|
|
table: "EntityCategorieRune",
|
|
column: "IdPageRune");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EntityCategorieRune_IdRune",
|
|
table: "EntityCategorieRune",
|
|
column: "IdRune");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Skills_ChampionId",
|
|
table: "Skills",
|
|
column: "ChampionId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Skins_Champions_ChampionId",
|
|
table: "Skins",
|
|
column: "ChampionId",
|
|
principalTable: "Champions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Skins_Champions_ChampionId",
|
|
table: "Skins");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "EntityCategorieRune");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Skills");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "EntityPageRune");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Family",
|
|
table: "Runes");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Classe",
|
|
table: "Champions");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "ChampionId",
|
|
table: "Skins",
|
|
newName: "ChampionForeignKey");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_Skins_ChampionId",
|
|
table: "Skins",
|
|
newName: "IX_Skins_ChampionForeignKey");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Skins_Champions_ChampionForeignKey",
|
|
table: "Skins",
|
|
column: "ChampionForeignKey",
|
|
principalTable: "Champions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|