using Microsoft.EntityFrameworkCore.Migrations; namespace ErsatzTV.Infrastructure.Sqlite.Migrations { public partial class Add_TraktList : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "TraktList", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), TraktId = table.Column(type: "INTEGER", nullable: false), User = table.Column(type: "TEXT", nullable: true), List = table.Column(type: "TEXT", nullable: true), Name = table.Column(type: "TEXT", nullable: true), Description = table.Column(type: "TEXT", nullable: true), ItemCount = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TraktList", x => x.Id); }); migrationBuilder.CreateTable( name: "TraktListItem", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), TraktListId = table.Column(type: "INTEGER", nullable: false), Kind = table.Column(type: "INTEGER", nullable: false), TraktId = table.Column(type: "INTEGER", nullable: false), Rank = table.Column(type: "INTEGER", nullable: false), Title = table.Column(type: "TEXT", nullable: true), Year = table.Column(type: "INTEGER", nullable: true), Season = table.Column(type: "INTEGER", nullable: true), Episode = table.Column(type: "INTEGER", nullable: true), MediaItemId = table.Column(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(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Guid = table.Column(type: "TEXT", nullable: true), TraktListItemId = table.Column(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"); } } }