using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace API.Data.Migrations { /// public partial class BookAnnotations : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "ChapterTitle", table: "AppUserTableOfContent", type: "TEXT", nullable: true); migrationBuilder.AddColumn( name: "SelectedText", table: "AppUserTableOfContent", type: "TEXT", nullable: true); migrationBuilder.CreateTable( name: "AppUserAnnotation", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), XPath = table.Column(type: "TEXT", nullable: true), EndingXPath = table.Column(type: "TEXT", nullable: true), SelectedText = table.Column(type: "TEXT", nullable: true), Comment = table.Column(type: "TEXT", nullable: true), HighlightCount = table.Column(type: "INTEGER", nullable: false), PageNumber = table.Column(type: "INTEGER", nullable: false), HighlightColor = table.Column(type: "INTEGER", nullable: false), ContainsSpoiler = table.Column(type: "INTEGER", nullable: false), SeriesId = table.Column(type: "INTEGER", nullable: false), VolumeId = table.Column(type: "INTEGER", nullable: false), ChapterId = table.Column(type: "INTEGER", nullable: false), AppUserId = table.Column(type: "INTEGER", nullable: false), Created = table.Column(type: "TEXT", nullable: false), CreatedUtc = table.Column(type: "TEXT", nullable: false), LastModified = table.Column(type: "TEXT", nullable: false), LastModifiedUtc = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppUserAnnotation", x => x.Id); table.ForeignKey( name: "FK_AppUserAnnotation_AspNetUsers_AppUserId", column: x => x.AppUserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AppUserAnnotation_Chapter_ChapterId", column: x => x.ChapterId, principalTable: "Chapter", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_AppUserAnnotation_AppUserId", table: "AppUserAnnotation", column: "AppUserId"); migrationBuilder.CreateIndex( name: "IX_AppUserAnnotation_ChapterId", table: "AppUserAnnotation", column: "ChapterId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AppUserAnnotation"); migrationBuilder.DropColumn( name: "ChapterTitle", table: "AppUserTableOfContent"); migrationBuilder.DropColumn( name: "SelectedText", table: "AppUserTableOfContent"); } } }