From 841128caee2a64b70c40dbfe4d6b89e376b984b1 Mon Sep 17 00:00:00 2001 From: Cody Kickertz Date: Sun, 21 Dec 2025 15:42:10 -0600 Subject: [PATCH] feat(db): add MediaType discriminator to Movies table (#116) Adds foundation for multi-media support by: - Adding MediaType column to Movies table (migration 244) - Adding MediaType property to Movie entity, defaulting to Movie Existing movies will have MediaType=1 (Movie) after migration. This prepares for future Book and Audiobook media types. Addresses Issue #1 Co-authored-by: admin --- .../Migration/244_add_mediatype_to_movies.cs | 14 ++++++++++++++ src/NzbDrone.Core/Movies/Movie.cs | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 src/NzbDrone.Core/Datastore/Migration/244_add_mediatype_to_movies.cs diff --git a/src/NzbDrone.Core/Datastore/Migration/244_add_mediatype_to_movies.cs b/src/NzbDrone.Core/Datastore/Migration/244_add_mediatype_to_movies.cs new file mode 100644 index 0000000000..0d275ba2c2 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/244_add_mediatype_to_movies.cs @@ -0,0 +1,14 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(244)] + public class add_mediatype_to_movies : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("Movies").AddColumn("MediaType").AsInt32().WithDefaultValue(1); + } + } +} diff --git a/src/NzbDrone.Core/Movies/Movie.cs b/src/NzbDrone.Core/Movies/Movie.cs index 1ef429fa2c..bdb888e30c 100644 --- a/src/NzbDrone.Core/Movies/Movie.cs +++ b/src/NzbDrone.Core/Movies/Movie.cs @@ -4,6 +4,7 @@ using NzbDrone.Common.Extensions; using NzbDrone.Core.Datastore; using NzbDrone.Core.MediaFiles; +using NzbDrone.Core.MediaTypes; using NzbDrone.Core.Profiles.Qualities; namespace NzbDrone.Core.Movies @@ -14,9 +15,11 @@ public Movie() { Tags = new HashSet(); MovieMetadata = new MovieMetadata(); + MediaType = MediaType.Movie; } public int MovieMetadataId { get; set; } + public MediaType MediaType { get; set; } public bool Monitored { get; set; } public MovieStatusType MinimumAvailability { get; set; }