Add database migration to SQLite

pull/3924/head
Joshua M. Boniface 4 years ago
parent 2f1471c61a
commit b48c8f7592

File diff suppressed because it is too large Load Diff

@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace Ombi.Store.Migrations.OmbiSqlite
{
public partial class Jellyfin : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "JellyfinContent",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AddedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
JellyfinId = table.Column<string>(type: "TEXT", nullable: false),
ProviderId = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: true),
Type = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JellyfinContent", x => x.Id);
table.UniqueConstraint("AK_JellyfinContent_JellyfinId", x => x.JellyfinId);
});
migrationBuilder.CreateTable(
name: "JellyfinEpisode",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AddedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
JellyfinId = table.Column<string>(type: "TEXT", nullable: true),
EpisodeNumber = table.Column<int>(type: "INTEGER", nullable: false),
ParentId = table.Column<string>(type: "TEXT", nullable: true),
ProviderId = table.Column<string>(type: "TEXT", nullable: true),
SeasonNumber = table.Column<int>(type: "INTEGER", nullable: false),
Title = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_JellyfinEpisode", x => x.Id);
table.ForeignKey(
name: "FK_JellyfinEpisode_JellyfinContent_ParentId",
column: x => x.ParentId,
principalTable: "JellyfinContent",
principalColumn: "JellyfinId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_JellyfinEpisode_ParentId",
table: "JellyfinEpisode",
column: "ParentId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "JellyfinContent");
migrationBuilder.DropTable(
name: "JellyfinEpisode");
}
}
}
Loading…
Cancel
Save