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
migrationBuilder.Sql(
"""
update episodes as e set external_id = jsonb_build_object(
'ShowId', e.show_id,
'SeasonNumber', e.season_number,
'EpisodeNumber', e.episode_number,
update episodes as e set external_id = (
SELECT jsonb_build_object(
'themoviedatabase', jsonb_build_object(
'ShowId', s.external_id->'themoviedatabase'->'DataId',
'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>),
new JsonTypeHandler<Dictionary<string, MetadataId>>()
);
SqlMapper.AddTypeHandler(
typeof(Dictionary<string, EpisodeId>),
new JsonTypeHandler<Dictionary<string, EpisodeId>>()
);
SqlMapper.AddTypeHandler(
typeof(Dictionary<string, string>),
new JsonTypeHandler<Dictionary<string, string>>()