Lots of changes to get code ready to add library.
This commit is contained in:
parent
67b97b3be2
commit
d5eed4e85d
20 changed files with 570 additions and 3 deletions
71
API/Data/Migrations/20201215195007_AddedLibrary.cs
Normal file
71
API/Data/Migrations/20201215195007_AddedLibrary.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
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<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: true),
|
||||
CoverImage = table.Column<string>(type: "TEXT", nullable: true),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
AppUserId = table.Column<int>(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<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Path = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LibraryId = table.Column<int>(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");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue