Add runtime on the back

This commit is contained in:
Zoe Roux
2023-10-31 23:47:08 +01:00
parent 15a4280a36
commit c4f1e420f8
11 changed files with 95 additions and 24 deletions
@@ -121,6 +121,10 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("release_date");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<int?>("SeasonId")
.HasColumnType("integer")
.HasColumnName("season_id");
@@ -212,10 +216,13 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("path");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(256)
@@ -298,10 +305,13 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("path");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(256)
@@ -402,10 +412,13 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("path");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<int?>("SeasonNumber")
.HasColumnType("integer")
.HasColumnName("season_number");
@@ -628,7 +641,6 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("overview");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");
@@ -34,21 +34,21 @@ namespace Kyoo.Postgresql.Migrations
s.id, s.slug, s.name, s.tagline, s.aliases, s.overview, s.tags, s.genres, s.status,
s.start_air, s.end_air, s.poster_source, s.poster_blurhash, s.thumbnail_source, s.thumbnail_blurhash,
s.logo_source, s.logo_blurhash, s.trailer, s.external_id, s.start_air AS air_date, NULL as path,
'show'::item_kind AS kind, s.added_date, s.rating
'show'::item_kind AS kind, s.added_date, s.rating, NULL AS runtime
FROM shows AS s
UNION ALL
SELECT
-m.id, m.slug, m.name, m.tagline, m.aliases, m.overview, m.tags, m.genres, m.status,
m.air_date as start_air, m.air_date as end_air, m.poster_source, m.poster_blurhash, m.thumbnail_source,
m.thumbnail_blurhash, m.logo_source, m.logo_blurhash, m.trailer, m.external_id, m.air_date, m.path,
'movie'::item_kind AS kind, m.added_date, m.rating
'movie'::item_kind AS kind, m.added_date, m.rating, m.runtime
FROM movies AS m
UNION ALL
SELECT
c.id + 10000 AS id, c.slug, c.name, NULL as tagline, NULL as alises, c.overview, NULL AS tags, NULL AS genres, 'unknown'::status AS status,
NULL AS start_air, NULL AS end_air, c.poster_source, c.poster_blurhash, c.thumbnail_source,
c.thumbnail_blurhash, c.logo_source, c.logo_blurhash, NULL as trailer, c.external_id, NULL AS air_date, NULL as path,
'collection'::item_kind AS kind, c.added_date, NULL as rating
'collection'::item_kind AS kind, c.added_date, NULL AS rating, NULL AS runtime
FROM collections AS c
");
@@ -62,7 +62,7 @@ namespace Kyoo.Postgresql.Migrations
'episode'::news_kind AS kind, e.added_date, s.id AS show_id, s.slug AS show_slug, s.name AS show_name,
s.poster_source AS show_poster_source, s.poster_blurhash AS show_poster_blurhash, s.thumbnail_source AS show_thumbnail_source,
s.thumbnail_blurhash AS show_thumbnail_blurhash, s.logo_source AS show_logo_source, s.logo_blurhash AS show_logo_blurhash,
NULL as rating
NULL as rating, e.runtime
FROM episodes AS e
LEFT JOIN shows AS s ON e.show_id = s.id
UNION ALL
@@ -72,7 +72,7 @@ namespace Kyoo.Postgresql.Migrations
m.logo_source, m.logo_blurhash, m.trailer, m.external_id, NULL AS season_number, NULL AS episode_number, NULL as absolute_number,
'movie'::news_kind AS kind, m.added_date, NULL AS show_id, NULL AS show_slug, NULL AS show_name,
NULL AS show_poster_source, NULL AS show_poster_blurhash, NULL AS show_thumbnail_source, NULL AS show_thumbnail_blurhash,
NULL AS show_logo_source, NULL AS show_logo_blurhash, m.rating
NULL AS show_logo_source, NULL AS show_logo_blurhash, m.rating, m.runtime
FROM movies AS m
");
}
@@ -96,6 +96,20 @@ namespace Kyoo.Postgresql.Migrations
type: "integer",
nullable: false);
migrationBuilder.AddColumn<int>(
name: "runtime",
table: "movies",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "runtime",
table: "episodes",
type: "integer",
nullable: false,
defaultValue: 0);
CreateItemView(migrationBuilder);
}
@@ -114,6 +128,14 @@ namespace Kyoo.Postgresql.Migrations
name: "rating",
table: "movies");
migrationBuilder.DropColumn(
name: "runtime",
table: "movies");
migrationBuilder.DropColumn(
name: "runtime",
table: "episodes");
AddedDate.CreateItemView(migrationBuilder);
}
}
@@ -1,4 +1,4 @@
// <auto-generated />
// <auto-generated />
using System;
using System.Collections.Generic;
using Kyoo.Abstractions.Models;
@@ -118,6 +118,10 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnType("timestamp with time zone")
.HasColumnName("release_date");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<int?>("SeasonId")
.HasColumnType("integer")
.HasColumnName("season_id");
@@ -209,10 +213,13 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("path");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(256)
@@ -295,10 +302,13 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("path");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(256)
@@ -399,10 +409,13 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("path");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");
b.Property<int>("Runtime")
.HasColumnType("integer")
.HasColumnName("runtime");
b.Property<int?>("SeasonNumber")
.HasColumnType("integer")
.HasColumnName("season_number");
@@ -625,7 +638,6 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("overview");
b.Property<int>("Rating")
.IsRequired()
.HasColumnType("integer")
.HasColumnName("rating");