mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Add database migration to SQLite
This commit is contained in:
parent
2f1471c61a
commit
b48c8f7592
2 changed files with 1290 additions and 0 deletions
1221
src/Ombi.Store/Migrations/OmbiSqlite/20201211042424_Jellyfin.Designer.cs
generated
Normal file
1221
src/Ombi.Store/Migrations/OmbiSqlite/20201211042424_Jellyfin.Designer.cs
generated
Normal file
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…
Add table
Add a link
Reference in a new issue