fixup! Add next refresh date migration

This commit is contained in:
Zoe Roux 2024-04-16 01:10:45 +02:00
parent e39337f8f1
commit c4cd4ead44
No known key found for this signature in database
2 changed files with 15 additions and 5 deletions

View File

@ -54,11 +54,17 @@ public partial class AddNextRefresh : Migration
// language=PostgreSQL // language=PostgreSQL
migrationBuilder.Sql( migrationBuilder.Sql(
""" """
update episodes as e set external_id = jsonb_build_object( update episodes as e set external_id = (
'ShowId', e.show_id, SELECT jsonb_build_object(
'SeasonNumber', e.season_number, 'themoviedatabase', jsonb_build_object(
'EpisodeNumber', e.episode_number, 'ShowId', s.external_id->'themoviedatabase'->'DataId',
'Link', null 'Season', e.season_number,
'Episode', e.episode_number,
'Link', null
)
)
FROM shows AS s
WHERE s.id = e.show_id
); );
""" """
); );

View File

@ -82,6 +82,10 @@ public class PostgresContext(DbContextOptions options, IHttpContextAccessor acce
typeof(Dictionary<string, MetadataId>), typeof(Dictionary<string, MetadataId>),
new JsonTypeHandler<Dictionary<string, MetadataId>>() new JsonTypeHandler<Dictionary<string, MetadataId>>()
); );
SqlMapper.AddTypeHandler(
typeof(Dictionary<string, EpisodeId>),
new JsonTypeHandler<Dictionary<string, EpisodeId>>()
);
SqlMapper.AddTypeHandler( SqlMapper.AddTypeHandler(
typeof(Dictionary<string, string>), typeof(Dictionary<string, string>),
new JsonTypeHandler<Dictionary<string, string>>() new JsonTypeHandler<Dictionary<string, string>>()