Der Server weiss jetzt mehr als Titel und Plakat

Bisher standen zu einem Film vier Angaben in der Datenbank: Titel, Jahr,
Beschreibung, zwei Bilder. Damit lässt sich eine Kachel zeichnen und sonst
nichts — keine Detailseite, die mehr sagt als der Dateiname, keine
Vorschläge, kein Filter nach Genre. Alles drei hing daran.

Jetzt kommen dazu: **Laufzeit, Bewertung, Werbezeile, Altersfreigabe,
Genres, Besetzung, Stab — und der Schriftzug des Titels.** Letzterer ist
das, was eine Startseite teuer aussehen lässt: „Blade Runner 2049" in seiner
eigenen Schrift über dem Hintergrundbild statt in der Systemschrift.

**Alles in einer Anfrage.** `append_to_response` hängt Besetzung,
Fremdkennungen, Freigaben und Bilder an den Einzelabruf. Vier getrennte
Anfragen je Titel wären bei vierhundert Filmen sechzehnhundert, und TMDB
begrenzt, wie oft man fragen darf. Der eigene Abruf der IMDb-Kennung ist
dabei entfallen — sie hängt jetzt mit dran.

Freigaben sind national: die FSK gilt in Deutschland, die MPAA in den USA,
und TMDB führt beide nebeneinander. Genommen wird die des eingestellten
Landes. Beim Schriftzug entscheidet zuerst die Sprache und erst danach die
Bildbewertung — ein deutscher Titel in deutscher Schrift schlägt den besser
bewerteten englischen.

Vom Stab nur Regie und Drehbuch. TMDB führt dort auch Beleuchter und
Caterer; eine Detailseite, die alle nennt, nennt nichts.

**Genres und Personen als eigene Tabellen**, nicht als Text im Film. Sonst:
filtern über `LIKE`, Tippfehler als eigenes Genre, und bei einer Umbenennung
vierhundert Zeilen anfassen. Personen über die Kennung der Quelle geführt,
nicht über den Namen — es gibt zwei Schauspieler namens „Chris Evans".

Darauf sitzen zwei neue Endpunkte: ein Filter nach Genre (nur die, die in
der Mediathek auch vorkommen — ein Knopf zu einer leeren Liste ist schlimmer
als kein Knopf) und **Vorschläge** über die Genres des zuletzt Gesehenen.
Keine Empfehlungsmaschine: ein Haushaltsserver hat keine Millionen
Sehverläufe, aus denen sich etwas lernen liesse. Eine schlichte Regel ist
nachvollziehbar, was eine undurchschaubare Empfehlung nie ist.

---

**Zwei Fehler, beide fand erst der echte Lauf.**

`UNIQUE constraint failed: Genres.Name`, und damit scheiterte der ganze
Scan — in der Mediathek erschien kein einziger Titel. Vier Bibliotheken
scannen gleichzeitig, jede mit eigenem Datenbankkontext; zwei stossen auf
„Drama", keine sieht die ungespeicherte Zeile der anderen. Statt die Läufe
zu serialisieren — das kostete bei zehn Bibliotheken das Zehnfache an Zeit —
wird der Fehlschlag hingenommen und die Zeile des anderen benutzt. Sie steht
ja genau dafür da.

Und: **eine geänderte Sprache erreichte vorhandene Titel nie.** Ein zweiter
Scan fragt nichts erneut, das ist Absicht. Wer aber von Englisch auf Deutsch
stellt, bekam deutsche Titel erst beim nächsten neuen Film. Dafür gibt es
jetzt „Metadaten auffrischen" je Bibliothek — geholt über die bekannte
Kennung, nicht über eine neue Suche, damit eine Zuordnung von Hand
stehenbleibt.

368 Tests grün, zehn davon neu. Am Container nachgewiesen: „Der Untergang",
156 Minuten, FSK 12, Bewertung 7,9, Genres Drama/Historie/Kriegsfilm,
22 Mitwirkende mit Rollennamen, Schriftzug und Hintergrund da — und nach dem
Umstellen auf de-DE heisst er nicht mehr „Downfall".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-10-03 23:12:35 +02:00
co-authored by Claude Opus 5
parent 230beb9664
commit ede4069cd4
15 changed files with 2337 additions and 61 deletions
+51
View File
@@ -34,6 +34,10 @@ public sealed class FlaroContext(DbContextOptions<FlaroContext> options) : DbCon
public DbSet<Episode> Episodes => Set<Episode>();
public DbSet<MediaStream> MediaStreams => Set<MediaStream>();
public DbSet<UserItemState> UserItemStates => Set<UserItemState>();
public DbSet<Genre> Genres => Set<Genre>();
public DbSet<GenreLink> GenreLinks => Set<GenreLink>();
public DbSet<Person> People => Set<Person>();
public DbSet<Credit> Credits => Set<Credit>();
/// <summary>Gilt für jede Zeitangabe im Modell, ohne sie einzeln zu nennen.</summary>
///
@@ -124,6 +128,8 @@ public sealed class FlaroContext(DbContextOptions<FlaroContext> options) : DbCon
e.Property(x => x.Title).HasMaxLength(512);
e.Property(x => x.SortTitleValue).HasMaxLength(512);
e.Property(x => x.ImdbId).HasMaxLength(32);
e.Property(x => x.Tagline).HasMaxLength(512);
e.Property(x => x.ContentRating).HasMaxLength(16);
e.HasOne<Core.Libraries.Library>().WithMany().HasForeignKey(x => x.LibraryId)
.OnDelete(DeleteBehavior.Cascade);
});
@@ -135,6 +141,8 @@ public sealed class FlaroContext(DbContextOptions<FlaroContext> options) : DbCon
e.Property(x => x.Title).HasMaxLength(512);
e.Property(x => x.SortTitleValue).HasMaxLength(512);
e.Property(x => x.ImdbId).HasMaxLength(32);
e.Property(x => x.Tagline).HasMaxLength(512);
e.Property(x => x.ContentRating).HasMaxLength(16);
e.HasOne<Core.Libraries.Library>().WithMany().HasForeignKey(x => x.LibraryId)
.OnDelete(DeleteBehavior.Cascade);
});
@@ -152,6 +160,49 @@ public sealed class FlaroContext(DbContextOptions<FlaroContext> options) : DbCon
e.HasOne<MediaFile>().WithMany().HasForeignKey(x => x.MediaFileId).OnDelete(DeleteBehavior.Cascade);
});
b.Entity<Genre>(e =>
{
e.HasKey(x => x.Id);
// Ein Name genau einmal. „Science Fiction" zweimal in der Tabelle
// hiesse: ein Filter, der die Hälfte übersieht.
e.HasIndex(x => x.Name).IsUnique();
e.Property(x => x.Name).HasMaxLength(64).UseCollation("NOCASE");
});
b.Entity<GenreLink>(e =>
{
e.HasKey(x => x.Id);
e.HasIndex(x => new { x.GenreId, x.MovieId }).IsUnique().HasFilter("\"MovieId\" IS NOT NULL");
e.HasIndex(x => new { x.GenreId, x.SeriesId }).IsUnique().HasFilter("\"SeriesId\" IS NOT NULL");
e.HasIndex(x => x.MovieId);
e.HasIndex(x => x.SeriesId);
e.HasOne<Genre>().WithMany().HasForeignKey(x => x.GenreId).OnDelete(DeleteBehavior.Cascade);
e.HasOne<Movie>().WithMany().HasForeignKey(x => x.MovieId).OnDelete(DeleteBehavior.Cascade);
e.HasOne<Series>().WithMany().HasForeignKey(x => x.SeriesId).OnDelete(DeleteBehavior.Cascade);
});
b.Entity<Person>(e =>
{
e.HasKey(x => x.Id);
// Über die Kennung der Quelle, nicht über den Namen: es gibt zwei
// Schauspieler namens „Chris Evans".
e.HasIndex(x => x.TmdbId).IsUnique();
e.Property(x => x.Name).HasMaxLength(256);
});
b.Entity<Credit>(e =>
{
e.HasKey(x => x.Id);
e.HasIndex(x => x.MovieId);
e.HasIndex(x => x.SeriesId);
e.HasIndex(x => x.PersonId);
e.Property(x => x.Character).HasMaxLength(256);
e.Property(x => x.Role).HasConversion<string>().HasMaxLength(16);
e.HasOne<Person>().WithMany().HasForeignKey(x => x.PersonId).OnDelete(DeleteBehavior.Cascade);
e.HasOne<Movie>().WithMany().HasForeignKey(x => x.MovieId).OnDelete(DeleteBehavior.Cascade);
e.HasOne<Series>().WithMany().HasForeignKey(x => x.SeriesId).OnDelete(DeleteBehavior.Cascade);
});
b.Entity<UserItemState>(e =>
{
e.HasKey(x => x.Id);
+178 -10
View File
@@ -32,7 +32,18 @@ public sealed class MetadataEnricher(
ISidecarStore beiwerk,
ILogger<MetadataEnricher> log)
{
public async Task<EnrichReport> EnrichAsync(Guid libraryId, CancellationToken ct = default)
/// <param name="erneut">
/// <b>Auch holen, was schon zugeordnet ist.</b> Im Normalfall fragt ein
/// zweiter Lauf nichts erneut — das ist schneller und hält Handarbeit.
/// Aber wer die Sprache von Englisch auf Deutsch stellt, bekommt sonst
/// nie deutsche Titel: die Einstellung griffe erst beim nächsten neuen
/// Film. Dasselbe gilt, wenn eine Quelle Beschreibungen nachträgt.
///
/// <b>Nachgeholt wird über die bekannte Kennung, nicht über eine neue
/// Suche.</b> Eine Zuordnung von Hand bleibt damit stehen.
/// </param>
public async Task<EnrichReport> EnrichAsync(
Guid libraryId, bool erneut = false, CancellationToken ct = default)
{
if (!await anbieter.IsConfiguredAsync(ct))
{
@@ -43,9 +54,9 @@ public sealed class MetadataEnricher(
int filme = 0, serien = 0, folgen = 0;
try
{
filme = await FilmeZuordnen(libraryId, ct);
serien = await SerienZuordnen(libraryId, ct);
folgen = await FolgenZuordnen(libraryId, ct);
filme = await FilmeZuordnen(libraryId, erneut, ct);
serien = await SerienZuordnen(libraryId, erneut, ct);
folgen = await FolgenZuordnen(libraryId, erneut, ct);
}
catch (MetadataCredentialsException fehler)
{
@@ -60,9 +71,11 @@ public sealed class MetadataEnricher(
return new EnrichReport(filme, serien, folgen, Skipped: false, null);
}
private async Task<int> FilmeZuordnen(Guid libraryId, CancellationToken ct)
private async Task<int> FilmeZuordnen(Guid libraryId, bool erneut, CancellationToken ct)
{
var offen = await db.Movies.Where(m => m.LibraryId == libraryId && m.TmdbId == null).ToListAsync(ct);
var offen = await db.Movies
.Where(m => m.LibraryId == libraryId && (erneut || m.TmdbId == null))
.ToListAsync(ct);
var zugeordnet = 0;
foreach (var film in offen)
@@ -91,7 +104,15 @@ public sealed class MetadataEnricher(
film.Overview = gefunden.Overview;
film.PosterImage = await BildAblegen(gefunden.Poster, ct);
film.BackdropImage = await BildAblegen(gefunden.Backdrop, ct);
film.LogoImage = await BildAblegen(gefunden.Logo, ct);
film.RuntimeMinutes = gefunden.RuntimeMinutes;
film.Rating = gefunden.Rating;
film.Tagline = gefunden.Tagline;
film.ContentRating = gefunden.ContentRating;
film.MatchLocked = festgelegt;
await GenresSetzen(gefunden.Genres, film: film.Id, serie: null, ct);
await MitwirkendeSetzen(gefunden.Credits, film: film.Id, serie: null, ct);
zugeordnet++;
if (datei is not null) await FilmBeiwerk(film, datei, ct);
@@ -121,9 +142,11 @@ public sealed class MetadataEnricher(
return (new ProviderIds(ausNfo.Tmdb ?? ausPfad.Tmdb, ausNfo.Imdb ?? ausPfad.Imdb), Nfo.ReadLocked(nfo));
}
private async Task<int> SerienZuordnen(Guid libraryId, CancellationToken ct)
private async Task<int> SerienZuordnen(Guid libraryId, bool erneut, CancellationToken ct)
{
var offen = await db.Series.Where(s => s.LibraryId == libraryId && s.TmdbId == null).ToListAsync(ct);
var offen = await db.Series
.Where(s => s.LibraryId == libraryId && (erneut || s.TmdbId == null))
.ToListAsync(ct);
var zugeordnet = 0;
foreach (var serie in offen)
@@ -153,6 +176,14 @@ public sealed class MetadataEnricher(
serie.Overview = gefunden.Overview;
serie.PosterImage = await BildAblegen(gefunden.Poster, ct);
serie.BackdropImage = await BildAblegen(gefunden.Backdrop, ct);
serie.LogoImage = await BildAblegen(gefunden.Logo, ct);
serie.RuntimeMinutes = gefunden.RuntimeMinutes;
serie.Rating = gefunden.Rating;
serie.Tagline = gefunden.Tagline;
serie.ContentRating = gefunden.ContentRating;
await GenresSetzen(gefunden.Genres, film: null, serie: serie.Id, ct);
await MitwirkendeSetzen(gefunden.Credits, film: null, serie: serie.Id, ct);
serie.MatchLocked = festgelegt;
zugeordnet++;
@@ -199,7 +230,7 @@ public sealed class MetadataEnricher(
}
/// <summary>Folgen nachschlagen — aber nur bei Serien, die zugeordnet sind.</summary>
private async Task<int> FolgenZuordnen(Guid libraryId, CancellationToken ct)
private async Task<int> FolgenZuordnen(Guid libraryId, bool erneut, CancellationToken ct)
{
var serien = await db.Series
.Where(s => s.LibraryId == libraryId && s.TmdbId != null)
@@ -209,7 +240,7 @@ public sealed class MetadataEnricher(
var kennungen = serien.Select(s => s.Id).ToList();
var offen = await db.Episodes
.Where(f => kennungen.Contains(f.SeriesId) && f.Overview == null)
.Where(f => kennungen.Contains(f.SeriesId) && (erneut || f.Overview == null))
.ToListAsync(ct);
var zugeordnet = 0;
@@ -236,6 +267,143 @@ public sealed class MetadataEnricher(
return zugeordnet;
}
/// <summary>Schreibt die Genres eines Titels — alte weg, neue hin.</summary>
///
/// <remarks>
/// <b>Ersetzen statt ergänzen.</b> Nach einer Korrektur von Hand ist es
/// ein anderer Film; die Genres des vorigen stehen zu lassen hiesse, aus
/// zwei Zuordnungen eine falsche dritte zu machen.
/// </remarks>
private async Task GenresSetzen(
IReadOnlyList<string>? namen, Guid? film, Guid? serie, CancellationToken ct)
{
await db.GenreLinks
.Where(l => film != null ? l.MovieId == film : l.SeriesId == serie)
.ExecuteDeleteAsync(ct);
if (namen is not { Count: > 0 }) return;
foreach (var name in namen)
{
db.GenreLinks.Add(new GenreLink
{
GenreId = await GenreKennung(name, ct), MovieId = film, SeriesId = serie,
});
}
}
/// <summary>Die Kennung eines Genres — angelegt, falls es sie nicht gibt.</summary>
///
/// <remarks>
/// <b>Sofort gespeichert, und mit einem zweiten Blick nach dem Fehlschlag.</b>
///
/// Der Scan läuft je Bibliothek, und vier Bibliotheken scannen gleichzeitig
/// — jede mit eigenem Datenbankkontext. Zwei davon stossen auf „Drama",
/// keine sieht die ungespeicherte Zeile der anderen, und beide legen sie
/// an. Am Ende scheitert der ganze Lauf an
/// <c>UNIQUE constraint failed: Genres.Name</c>, und zwar mitsamt allem,
/// was sonst noch im Stapel stand: in der Mediathek erschien kein
/// einziger Titel.
///
/// Statt die Läufe zu serialisieren — das kostete bei zehn Bibliotheken
/// das Zehnfache an Zeit — wird der Fehlschlag hingenommen und die Zeile
/// des anderen benutzt. Sie steht ja genau dafür da.
/// </remarks>
private async Task<Guid> GenreKennung(string name, CancellationToken ct)
{
var vorhanden = db.Genres.Local
.FirstOrDefault(g => string.Equals(g.Name, name, StringComparison.OrdinalIgnoreCase))
?? await db.Genres.FirstOrDefaultAsync(g => g.Name == name, ct);
if (vorhanden is not null) return vorhanden.Id;
var neu = new Genre { Name = name };
db.Genres.Add(neu);
try
{
await db.SaveChangesAsync(ct);
return neu.Id;
}
catch (DbUpdateException)
{
// Ein anderer Lauf war schneller. Die eigene Zeile wieder
// vergessen, sonst versucht der nächste Speichervorgang sie
// erneut — und scheitert wieder.
db.Entry(neu).State = EntityState.Detached;
var fremd = await db.Genres.FirstOrDefaultAsync(g => g.Name == name, ct);
if (fremd is not null) return fremd.Id;
throw;
}
}
/// <summary>Schreibt Besetzung und Stab — ebenfalls ersetzend.</summary>
private async Task MitwirkendeSetzen(
IReadOnlyList<CreditMetadata>? mitwirkende, Guid? film, Guid? serie, CancellationToken ct)
{
await db.Credits
.Where(c => film != null ? c.MovieId == film : c.SeriesId == serie)
.ExecuteDeleteAsync(ct);
if (mitwirkende is not { Count: > 0 }) return;
foreach (var eintrag in mitwirkende)
{
db.Credits.Add(new Credit
{
PersonId = await PersonKennung(eintrag, ct),
MovieId = film,
SeriesId = serie,
Role = eintrag.Kind switch
{
CreditKind.Director => CreditRole.Director,
CreditKind.Writer => CreditRole.Writer,
_ => CreditRole.Actor,
},
Character = eintrag.Character,
Order = eintrag.Order,
});
}
}
/// <summary>Die Kennung einer Person — dieselbe Vorsicht wie beim Genre.</summary>
///
/// <remarks>
/// Dieselbe Lage: zwei Bibliotheken, zwei Kontexte, derselbe Schauspieler.
/// </remarks>
private async Task<Guid> PersonKennung(CreditMetadata eintrag, CancellationToken ct)
{
var vorhanden = db.People.Local.FirstOrDefault(p => p.TmdbId == eintrag.ProviderId)
?? await db.People.FirstOrDefaultAsync(p => p.TmdbId == eintrag.ProviderId, ct);
if (vorhanden is not null)
{
// Der Name kann sich ändern, und ein Porträt kann nachkommen. Ein
// vorhandenes gegen nichts zu tauschen wäre dagegen ein Rückschritt.
vorhanden.Name = eintrag.Name;
vorhanden.Image ??= await BildAblegen(eintrag.Portrait, ct);
return vorhanden.Id;
}
var neu = new Person
{
Name = eintrag.Name,
TmdbId = eintrag.ProviderId,
Image = await BildAblegen(eintrag.Portrait, ct),
};
db.People.Add(neu);
try
{
await db.SaveChangesAsync(ct);
return neu.Id;
}
catch (DbUpdateException)
{
db.Entry(neu).State = EntityState.Detached;
var fremd = await db.People.FirstOrDefaultAsync(p => p.TmdbId == eintrag.ProviderId, ct);
if (fremd is not null) return fremd.Id;
throw;
}
}
private async Task<string?> BildAblegen(RemoteImage? bild, CancellationToken ct) =>
bild is null ? null : await bilder.StoreAsync(bild, ct);
@@ -0,0 +1,774 @@
// <auto-generated />
using System;
using Flaro.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Flaro.Data.Migrations
{
[DbContext(typeof(FlaroContext))]
[Migration("20261003210324_Katalog")]
partial class Katalog
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.12");
modelBuilder.Entity("Flaro.Core.Auth.AuthCode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("ApprovedByUserId")
.HasColumnType("TEXT");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<long?>("ConsumedAt")
.HasColumnType("INTEGER");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("DeviceId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("DeviceName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<long>("ExpiresAt")
.HasColumnType("INTEGER");
b.Property<string>("HandleFingerprint")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Code");
b.HasIndex("HandleFingerprint")
.IsUnique();
b.ToTable("AuthCodes");
});
modelBuilder.Entity("Flaro.Core.Auth.DeviceToken", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("DeviceId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("DeviceName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<long>("LastSeenAt")
.HasColumnType("INTEGER");
b.Property<long?>("RevokedAt")
.HasColumnType("INTEGER");
b.Property<string>("TokenFingerprint")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.Property<Guid>("UserId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TokenFingerprint")
.IsUnique();
b.HasIndex("UserId");
b.ToTable("DeviceTokens");
});
modelBuilder.Entity("Flaro.Core.Libraries.Library", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<string>("Kind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Path")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Libraries");
});
modelBuilder.Entity("Flaro.Core.Library.Credit", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Character")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<Guid?>("MovieId")
.HasColumnType("TEXT");
b.Property<int>("Order")
.HasColumnType("INTEGER");
b.Property<Guid>("PersonId")
.HasColumnType("TEXT");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<Guid?>("SeriesId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("MovieId");
b.HasIndex("PersonId");
b.HasIndex("SeriesId");
b.ToTable("Credits");
});
modelBuilder.Entity("Flaro.Core.Library.Episode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long>("AddedAt")
.HasColumnType("INTEGER");
b.Property<int>("EpisodeNumber")
.HasColumnType("INTEGER");
b.Property<string>("Overview")
.HasColumnType("TEXT");
b.Property<int>("SeasonNumber")
.HasColumnType("INTEGER");
b.Property<Guid>("SeriesId")
.HasColumnType("TEXT");
b.Property<string>("StillImage")
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("SeriesId", "SeasonNumber", "EpisodeNumber")
.IsUnique();
b.ToTable("Episodes");
});
modelBuilder.Entity("Flaro.Core.Library.Genre", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Genres");
});
modelBuilder.Entity("Flaro.Core.Library.GenreLink", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid>("GenreId")
.HasColumnType("TEXT");
b.Property<Guid?>("MovieId")
.HasColumnType("TEXT");
b.Property<Guid?>("SeriesId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("MovieId");
b.HasIndex("SeriesId");
b.HasIndex("GenreId", "MovieId")
.IsUnique()
.HasFilter("\"MovieId\" IS NOT NULL");
b.HasIndex("GenreId", "SeriesId")
.IsUnique()
.HasFilter("\"SeriesId\" IS NOT NULL");
b.ToTable("GenreLinks");
});
modelBuilder.Entity("Flaro.Core.Library.MediaFile", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long?>("BitRate")
.HasColumnType("INTEGER");
b.Property<string>("Container")
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<long?>("Duration")
.HasColumnType("INTEGER");
b.Property<Guid?>("EpisodeId")
.HasColumnType("TEXT");
b.Property<Guid>("LibraryId")
.HasColumnType("TEXT");
b.Property<long>("ModifiedAt")
.HasColumnType("INTEGER");
b.Property<Guid?>("MovieId")
.HasColumnType("TEXT");
b.Property<string>("Path")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT");
b.Property<long?>("ProbedAt")
.HasColumnType("INTEGER");
b.Property<long>("SeenAt")
.HasColumnType("INTEGER");
b.Property<long>("SizeBytes")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("EpisodeId");
b.HasIndex("MovieId");
b.HasIndex("LibraryId", "Path")
.IsUnique();
b.ToTable("MediaFiles");
});
modelBuilder.Entity("Flaro.Core.Library.MediaStream", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<int?>("Channels")
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.HasMaxLength(64)
.HasColumnType("TEXT");
b.Property<int?>("Height")
.HasColumnType("INTEGER");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<bool>("IsDefault")
.HasColumnType("INTEGER");
b.Property<bool>("IsForced")
.HasColumnType("INTEGER");
b.Property<string>("Kind")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("Language")
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<Guid>("MediaFileId")
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<int?>("Width")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("MediaFileId", "Index")
.IsUnique();
b.ToTable("MediaStreams");
});
modelBuilder.Entity("Flaro.Core.Library.Movie", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long>("AddedAt")
.HasColumnType("INTEGER");
b.Property<string>("BackdropImage")
.HasColumnType("TEXT");
b.Property<string>("ContentRating")
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("ImdbId")
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<Guid>("LibraryId")
.HasColumnType("TEXT");
b.Property<string>("LogoImage")
.HasColumnType("TEXT");
b.Property<bool>("MatchLocked")
.HasColumnType("INTEGER");
b.Property<string>("Overview")
.HasColumnType("TEXT");
b.Property<string>("ParsedTitle")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("ParsedYear")
.HasColumnType("INTEGER");
b.Property<string>("PosterImage")
.HasColumnType("TEXT");
b.Property<double?>("Rating")
.HasColumnType("REAL");
b.Property<int?>("RuntimeMinutes")
.HasColumnType("INTEGER");
b.Property<string>("SortTitleValue")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Tagline")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("TmdbId")
.HasColumnType("INTEGER");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("LibraryId", "SortTitleValue");
b.ToTable("Movies");
});
modelBuilder.Entity("Flaro.Core.Library.Person", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Image")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<int>("TmdbId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("TmdbId")
.IsUnique();
b.ToTable("People");
});
modelBuilder.Entity("Flaro.Core.Library.Series", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long>("AddedAt")
.HasColumnType("INTEGER");
b.Property<string>("BackdropImage")
.HasColumnType("TEXT");
b.Property<string>("ContentRating")
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("ImdbId")
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<Guid>("LibraryId")
.HasColumnType("TEXT");
b.Property<string>("LogoImage")
.HasColumnType("TEXT");
b.Property<bool>("MatchLocked")
.HasColumnType("INTEGER");
b.Property<string>("Overview")
.HasColumnType("TEXT");
b.Property<string>("ParsedTitle")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("ParsedYear")
.HasColumnType("INTEGER");
b.Property<string>("PosterImage")
.HasColumnType("TEXT");
b.Property<double?>("Rating")
.HasColumnType("REAL");
b.Property<int?>("RuntimeMinutes")
.HasColumnType("INTEGER");
b.Property<string>("SortTitleValue")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Tagline")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("TmdbId")
.HasColumnType("INTEGER");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("LibraryId", "SortTitleValue");
b.ToTable("Series");
});
modelBuilder.Entity("Flaro.Core.Playback.UserItemState", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<bool>("Dismissed")
.HasColumnType("INTEGER");
b.Property<Guid?>("EpisodeId")
.HasColumnType("TEXT");
b.Property<bool>("Favourite")
.HasColumnType("INTEGER");
b.Property<bool>("InProgress")
.HasColumnType("INTEGER");
b.Property<long?>("LastPlayedAt")
.HasColumnType("INTEGER");
b.Property<Guid?>("MovieId")
.HasColumnType("TEXT");
b.Property<int>("PlayCount")
.HasColumnType("INTEGER");
b.Property<long>("Position")
.HasColumnType("INTEGER");
b.Property<int?>("Rating")
.HasColumnType("INTEGER");
b.Property<long?>("Runtime")
.HasColumnType("INTEGER");
b.Property<long>("UpdatedAt")
.HasColumnType("INTEGER");
b.Property<Guid>("UserId")
.HasColumnType("TEXT");
b.Property<bool>("Watched")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("EpisodeId");
b.HasIndex("MovieId");
b.HasIndex("UserId", "EpisodeId")
.IsUnique()
.HasFilter("\"EpisodeId\" IS NOT NULL");
b.HasIndex("UserId", "MovieId")
.IsUnique()
.HasFilter("\"MovieId\" IS NOT NULL");
b.HasIndex("UserId", "InProgress", "UpdatedAt");
b.ToTable("UserItemStates");
});
modelBuilder.Entity("Flaro.Core.ServerSetting", b =>
{
b.Property<string>("Key")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(4096)
.HasColumnType("TEXT");
b.HasKey("Key");
b.ToTable("Settings");
});
modelBuilder.Entity("Flaro.Core.Users.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<long>("CreatedAt")
.HasColumnType("INTEGER");
b.Property<bool>("IsAdministrator")
.HasColumnType("INTEGER");
b.Property<string>("PasswordHash")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.HasKey("Id");
b.HasIndex("UserName")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("Flaro.Core.Auth.DeviceToken", b =>
{
b.HasOne("Flaro.Core.Users.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Library.Credit", b =>
{
b.HasOne("Flaro.Core.Library.Movie", null)
.WithMany()
.HasForeignKey("MovieId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Flaro.Core.Library.Person", null)
.WithMany()
.HasForeignKey("PersonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Flaro.Core.Library.Series", null)
.WithMany()
.HasForeignKey("SeriesId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Flaro.Core.Library.Episode", b =>
{
b.HasOne("Flaro.Core.Library.Series", null)
.WithMany()
.HasForeignKey("SeriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Library.GenreLink", b =>
{
b.HasOne("Flaro.Core.Library.Genre", null)
.WithMany()
.HasForeignKey("GenreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Flaro.Core.Library.Movie", null)
.WithMany()
.HasForeignKey("MovieId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Flaro.Core.Library.Series", null)
.WithMany()
.HasForeignKey("SeriesId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Flaro.Core.Library.MediaFile", b =>
{
b.HasOne("Flaro.Core.Libraries.Library", null)
.WithMany()
.HasForeignKey("LibraryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Library.MediaStream", b =>
{
b.HasOne("Flaro.Core.Library.MediaFile", null)
.WithMany()
.HasForeignKey("MediaFileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Library.Movie", b =>
{
b.HasOne("Flaro.Core.Libraries.Library", null)
.WithMany()
.HasForeignKey("LibraryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Library.Series", b =>
{
b.HasOne("Flaro.Core.Libraries.Library", null)
.WithMany()
.HasForeignKey("LibraryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Playback.UserItemState", b =>
{
b.HasOne("Flaro.Core.Library.Episode", null)
.WithMany()
.HasForeignKey("EpisodeId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Flaro.Core.Library.Movie", null)
.WithMany()
.HasForeignKey("MovieId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Flaro.Core.Users.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,279 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Flaro.Data.Migrations
{
/// <inheritdoc />
public partial class Katalog : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ContentRating",
table: "Series",
type: "TEXT",
maxLength: 16,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LogoImage",
table: "Series",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<double>(
name: "Rating",
table: "Series",
type: "REAL",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "RuntimeMinutes",
table: "Series",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Tagline",
table: "Series",
type: "TEXT",
maxLength: 512,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ContentRating",
table: "Movies",
type: "TEXT",
maxLength: 16,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LogoImage",
table: "Movies",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<double>(
name: "Rating",
table: "Movies",
type: "REAL",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "RuntimeMinutes",
table: "Movies",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Tagline",
table: "Movies",
type: "TEXT",
maxLength: 512,
nullable: true);
migrationBuilder.CreateTable(
name: "Genres",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false, collation: "NOCASE")
},
constraints: table =>
{
table.PrimaryKey("PK_Genres", x => x.Id);
});
migrationBuilder.CreateTable(
name: "People",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
TmdbId = table.Column<int>(type: "INTEGER", nullable: false),
Image = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_People", x => x.Id);
});
migrationBuilder.CreateTable(
name: "GenreLinks",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
GenreId = table.Column<Guid>(type: "TEXT", nullable: false),
MovieId = table.Column<Guid>(type: "TEXT", nullable: true),
SeriesId = table.Column<Guid>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GenreLinks", x => x.Id);
table.ForeignKey(
name: "FK_GenreLinks_Genres_GenreId",
column: x => x.GenreId,
principalTable: "Genres",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GenreLinks_Movies_MovieId",
column: x => x.MovieId,
principalTable: "Movies",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GenreLinks_Series_SeriesId",
column: x => x.SeriesId,
principalTable: "Series",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Credits",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
PersonId = table.Column<Guid>(type: "TEXT", nullable: false),
MovieId = table.Column<Guid>(type: "TEXT", nullable: true),
SeriesId = table.Column<Guid>(type: "TEXT", nullable: true),
Role = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false),
Character = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Order = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Credits", x => x.Id);
table.ForeignKey(
name: "FK_Credits_Movies_MovieId",
column: x => x.MovieId,
principalTable: "Movies",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Credits_People_PersonId",
column: x => x.PersonId,
principalTable: "People",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Credits_Series_SeriesId",
column: x => x.SeriesId,
principalTable: "Series",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Credits_MovieId",
table: "Credits",
column: "MovieId");
migrationBuilder.CreateIndex(
name: "IX_Credits_PersonId",
table: "Credits",
column: "PersonId");
migrationBuilder.CreateIndex(
name: "IX_Credits_SeriesId",
table: "Credits",
column: "SeriesId");
migrationBuilder.CreateIndex(
name: "IX_GenreLinks_GenreId_MovieId",
table: "GenreLinks",
columns: new[] { "GenreId", "MovieId" },
unique: true,
filter: "\"MovieId\" IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_GenreLinks_GenreId_SeriesId",
table: "GenreLinks",
columns: new[] { "GenreId", "SeriesId" },
unique: true,
filter: "\"SeriesId\" IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_GenreLinks_MovieId",
table: "GenreLinks",
column: "MovieId");
migrationBuilder.CreateIndex(
name: "IX_GenreLinks_SeriesId",
table: "GenreLinks",
column: "SeriesId");
migrationBuilder.CreateIndex(
name: "IX_Genres_Name",
table: "Genres",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_People_TmdbId",
table: "People",
column: "TmdbId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Credits");
migrationBuilder.DropTable(
name: "GenreLinks");
migrationBuilder.DropTable(
name: "People");
migrationBuilder.DropTable(
name: "Genres");
migrationBuilder.DropColumn(
name: "ContentRating",
table: "Series");
migrationBuilder.DropColumn(
name: "LogoImage",
table: "Series");
migrationBuilder.DropColumn(
name: "Rating",
table: "Series");
migrationBuilder.DropColumn(
name: "RuntimeMinutes",
table: "Series");
migrationBuilder.DropColumn(
name: "Tagline",
table: "Series");
migrationBuilder.DropColumn(
name: "ContentRating",
table: "Movies");
migrationBuilder.DropColumn(
name: "LogoImage",
table: "Movies");
migrationBuilder.DropColumn(
name: "Rating",
table: "Movies");
migrationBuilder.DropColumn(
name: "RuntimeMinutes",
table: "Movies");
migrationBuilder.DropColumn(
name: "Tagline",
table: "Movies");
}
}
}
@@ -137,6 +137,44 @@ namespace Flaro.Data.Migrations
b.ToTable("Libraries");
});
modelBuilder.Entity("Flaro.Core.Library.Credit", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Character")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<Guid?>("MovieId")
.HasColumnType("TEXT");
b.Property<int>("Order")
.HasColumnType("INTEGER");
b.Property<Guid>("PersonId")
.HasColumnType("TEXT");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<Guid?>("SeriesId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("MovieId");
b.HasIndex("PersonId");
b.HasIndex("SeriesId");
b.ToTable("Credits");
});
modelBuilder.Entity("Flaro.Core.Library.Episode", b =>
{
b.Property<Guid>("Id")
@@ -173,6 +211,58 @@ namespace Flaro.Data.Migrations
b.ToTable("Episodes");
});
modelBuilder.Entity("Flaro.Core.Library.Genre", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Genres");
});
modelBuilder.Entity("Flaro.Core.Library.GenreLink", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid>("GenreId")
.HasColumnType("TEXT");
b.Property<Guid?>("MovieId")
.HasColumnType("TEXT");
b.Property<Guid?>("SeriesId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("MovieId");
b.HasIndex("SeriesId");
b.HasIndex("GenreId", "MovieId")
.IsUnique()
.HasFilter("\"MovieId\" IS NOT NULL");
b.HasIndex("GenreId", "SeriesId")
.IsUnique()
.HasFilter("\"SeriesId\" IS NOT NULL");
b.ToTable("GenreLinks");
});
modelBuilder.Entity("Flaro.Core.Library.MediaFile", b =>
{
b.Property<Guid>("Id")
@@ -291,6 +381,10 @@ namespace Flaro.Data.Migrations
b.Property<string>("BackdropImage")
.HasColumnType("TEXT");
b.Property<string>("ContentRating")
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("ImdbId")
.HasMaxLength(32)
.HasColumnType("TEXT");
@@ -298,6 +392,9 @@ namespace Flaro.Data.Migrations
b.Property<Guid>("LibraryId")
.HasColumnType("TEXT");
b.Property<string>("LogoImage")
.HasColumnType("TEXT");
b.Property<bool>("MatchLocked")
.HasColumnType("INTEGER");
@@ -314,11 +411,21 @@ namespace Flaro.Data.Migrations
b.Property<string>("PosterImage")
.HasColumnType("TEXT");
b.Property<double?>("Rating")
.HasColumnType("REAL");
b.Property<int?>("RuntimeMinutes")
.HasColumnType("INTEGER");
b.Property<string>("SortTitleValue")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Tagline")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(512)
@@ -337,6 +444,31 @@ namespace Flaro.Data.Migrations
b.ToTable("Movies");
});
modelBuilder.Entity("Flaro.Core.Library.Person", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Image")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<int>("TmdbId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("TmdbId")
.IsUnique();
b.ToTable("People");
});
modelBuilder.Entity("Flaro.Core.Library.Series", b =>
{
b.Property<Guid>("Id")
@@ -349,6 +481,10 @@ namespace Flaro.Data.Migrations
b.Property<string>("BackdropImage")
.HasColumnType("TEXT");
b.Property<string>("ContentRating")
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("ImdbId")
.HasMaxLength(32)
.HasColumnType("TEXT");
@@ -356,6 +492,9 @@ namespace Flaro.Data.Migrations
b.Property<Guid>("LibraryId")
.HasColumnType("TEXT");
b.Property<string>("LogoImage")
.HasColumnType("TEXT");
b.Property<bool>("MatchLocked")
.HasColumnType("INTEGER");
@@ -372,11 +511,21 @@ namespace Flaro.Data.Migrations
b.Property<string>("PosterImage")
.HasColumnType("TEXT");
b.Property<double?>("Rating")
.HasColumnType("REAL");
b.Property<int?>("RuntimeMinutes")
.HasColumnType("INTEGER");
b.Property<string>("SortTitleValue")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Tagline")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(512)
@@ -515,6 +664,25 @@ namespace Flaro.Data.Migrations
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Library.Credit", b =>
{
b.HasOne("Flaro.Core.Library.Movie", null)
.WithMany()
.HasForeignKey("MovieId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Flaro.Core.Library.Person", null)
.WithMany()
.HasForeignKey("PersonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Flaro.Core.Library.Series", null)
.WithMany()
.HasForeignKey("SeriesId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Flaro.Core.Library.Episode", b =>
{
b.HasOne("Flaro.Core.Library.Series", null)
@@ -524,6 +692,25 @@ namespace Flaro.Data.Migrations
.IsRequired();
});
modelBuilder.Entity("Flaro.Core.Library.GenreLink", b =>
{
b.HasOne("Flaro.Core.Library.Genre", null)
.WithMany()
.HasForeignKey("GenreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Flaro.Core.Library.Movie", null)
.WithMany()
.HasForeignKey("MovieId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Flaro.Core.Library.Series", null)
.WithMany()
.HasForeignKey("SeriesId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Flaro.Core.Library.MediaFile", b =>
{
b.HasOne("Flaro.Core.Libraries.Library", null)