using Microsoft.EntityFrameworkCore.Migrations; namespace API.Data.Migrations { public partial class AddedLibrary : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Library", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: true), CoverImage = table.Column(type: "TEXT", nullable: true), Type = table.Column(type: "INTEGER", nullable: false), AppUserId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Library", x => x.Id); table.ForeignKey( name: "FK_Library_Users_AppUserId", column: x => x.AppUserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "FolderPath", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Path = table.Column(type: "TEXT", nullable: true), LibraryId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_FolderPath", x => x.Id); table.ForeignKey( name: "FK_FolderPath_Library_LibraryId", column: x => x.LibraryId, principalTable: "Library", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_FolderPath_LibraryId", table: "FolderPath", column: "LibraryId"); migrationBuilder.CreateIndex( name: "IX_Library_AppUserId", table: "Library", column: "AppUserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "FolderPath"); migrationBuilder.DropTable( name: "Library"); } } }