93 lines
3.0 KiB
C#
93 lines
3.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Modules.Library.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class M004 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Anime_Episodes_Anime_Seasons_AnimeSeasonId",
|
|
table: "Anime_Episodes");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Anime_Episodes_AnimeSeasonId",
|
|
table: "Anime_Episodes");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "AnimeSeasonId",
|
|
table: "Anime_Episodes");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "Type",
|
|
table: "Anime_Episodes",
|
|
newName: "TypeFlag");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "SeasonId",
|
|
table: "Anime_Episodes",
|
|
type: "uuid",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Anime_Episodes_SeasonId",
|
|
table: "Anime_Episodes",
|
|
column: "SeasonId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Anime_Episodes_Anime_Seasons_SeasonId",
|
|
table: "Anime_Episodes",
|
|
column: "SeasonId",
|
|
principalTable: "Anime_Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Anime_Episodes_Anime_Seasons_SeasonId",
|
|
table: "Anime_Episodes");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Anime_Episodes_SeasonId",
|
|
table: "Anime_Episodes");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "SeasonId",
|
|
table: "Anime_Episodes");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "TypeFlag",
|
|
table: "Anime_Episodes",
|
|
newName: "Type");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "AnimeSeasonId",
|
|
table: "Anime_Episodes",
|
|
type: "uuid",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Anime_Episodes_AnimeSeasonId",
|
|
table: "Anime_Episodes",
|
|
column: "AnimeSeasonId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Anime_Episodes_Anime_Seasons_AnimeSeasonId",
|
|
table: "Anime_Episodes",
|
|
column: "AnimeSeasonId",
|
|
principalTable: "Anime_Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|