Files
ersatztv/ErsatzTV.Infrastructure.Sqlite/Migrations/20210529014509_Add_EpisodeMetadataDirectorsWriters.cs
T
Jason DoveandGitHub a7661c8498 add mysql database provider (#1375)
* refactor sqlite into separate library

* support mysql

* fixes

* sql fixes

* cleanup

* update changelog
2023-08-12 21:44:14 -05:00

76 lines
2.5 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
namespace ErsatzTV.Infrastructure.Sqlite.Migrations
{
public partial class Add_EpisodeMetadataDirectorsWriters : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "EpisodeMetadataId",
table: "Writer",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "EpisodeMetadataId",
table: "Director",
type: "INTEGER",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Writer_EpisodeMetadataId",
table: "Writer",
column: "EpisodeMetadataId");
migrationBuilder.CreateIndex(
name: "IX_Director_EpisodeMetadataId",
table: "Director",
column: "EpisodeMetadataId");
migrationBuilder.AddForeignKey(
name: "FK_Director_EpisodeMetadata_EpisodeMetadataId",
table: "Director",
column: "EpisodeMetadataId",
principalTable: "EpisodeMetadata",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Writer_EpisodeMetadata_EpisodeMetadataId",
table: "Writer",
column: "EpisodeMetadataId",
principalTable: "EpisodeMetadata",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Director_EpisodeMetadata_EpisodeMetadataId",
table: "Director");
migrationBuilder.DropForeignKey(
name: "FK_Writer_EpisodeMetadata_EpisodeMetadataId",
table: "Writer");
migrationBuilder.DropIndex(
name: "IX_Writer_EpisodeMetadataId",
table: "Writer");
migrationBuilder.DropIndex(
name: "IX_Director_EpisodeMetadataId",
table: "Director");
migrationBuilder.DropColumn(
name: "EpisodeMetadataId",
table: "Writer");
migrationBuilder.DropColumn(
name: "EpisodeMetadataId",
table: "Director");
}
}
}