* better trakt list support * update dependencies * revert unneeded brackets
109 lines
4.7 KiB
C#
109 lines
4.7 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace ErsatzTV.Infrastructure.Migrations
|
|
{
|
|
public partial class Add_TraktList : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "TraktList",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
TraktId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
User = table.Column<string>(type: "TEXT", nullable: true),
|
|
List = table.Column<string>(type: "TEXT", nullable: true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: true),
|
|
Description = table.Column<string>(type: "TEXT", nullable: true),
|
|
ItemCount = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TraktList", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TraktListItem",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
TraktListId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Kind = table.Column<int>(type: "INTEGER", nullable: false),
|
|
TraktId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Rank = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Title = table.Column<string>(type: "TEXT", nullable: true),
|
|
Year = table.Column<int>(type: "INTEGER", nullable: true),
|
|
Season = table.Column<int>(type: "INTEGER", nullable: true),
|
|
Episode = table.Column<int>(type: "INTEGER", nullable: true),
|
|
MediaItemId = table.Column<int>(type: "INTEGER", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TraktListItem", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_TraktListItem_MediaItem_MediaItemId",
|
|
column: x => x.MediaItemId,
|
|
principalTable: "MediaItem",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_TraktListItem_TraktList_TraktListId",
|
|
column: x => x.TraktListId,
|
|
principalTable: "TraktList",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TraktListItemGuid",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Guid = table.Column<string>(type: "TEXT", nullable: true),
|
|
TraktListItemId = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TraktListItemGuid", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_TraktListItemGuid_TraktListItem_TraktListItemId",
|
|
column: x => x.TraktListItemId,
|
|
principalTable: "TraktListItem",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TraktListItem_MediaItemId",
|
|
table: "TraktListItem",
|
|
column: "MediaItemId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TraktListItem_TraktListId",
|
|
table: "TraktListItem",
|
|
column: "TraktListId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TraktListItemGuid_TraktListItemId",
|
|
table: "TraktListItemGuid",
|
|
column: "TraktListItemId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "TraktListItemGuid");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TraktListItem");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TraktList");
|
|
}
|
|
}
|
|
}
|