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.

146 lines
5.6 KiB

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntityFramwork.Migrations
{
/// <inheritdoc />
public partial class test : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Images",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Base64 = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Images", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Champions",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Bio = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
ImageId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Champions", x => x.Id);
table.ForeignKey(
name: "FK_Champions_Images_ImageId",
column: x => x.ImageId,
principalTable: "Images",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Runes",
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),
Icon = table.Column<string>(type: "TEXT", nullable: false),
ImageId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Runes", x => x.Id);
table.ForeignKey(
name: "FK_Runes_Images_ImageId",
column: x => x.ImageId,
principalTable: "Images",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Skins",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Description = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
Price = table.Column<float>(type: "REAL", nullable: false),
ChampionForeignKey = table.Column<int>(type: "INTEGER", nullable: false),
ImageId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skins", x => x.Id);
table.ForeignKey(
name: "FK_Skins_Champions_ChampionForeignKey",
column: x => x.ChampionForeignKey,
principalTable: "Champions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Skins_Images_ImageId",
column: x => x.ImageId,
principalTable: "Images",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Champions_ImageId",
table: "Champions",
column: "ImageId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Champions_Name",
table: "Champions",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Runes_ImageId",
table: "Runes",
column: "ImageId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Skins_ChampionForeignKey",
table: "Skins",
column: "ChampionForeignKey");
migrationBuilder.CreateIndex(
name: "IX_Skins_ImageId",
table: "Skins",
column: "ImageId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Runes");
migrationBuilder.DropTable(
name: "Skins");
migrationBuilder.DropTable(
name: "Champions");
migrationBuilder.DropTable(
name: "Images");
}
}
}