< Summary - Jellyfin

Information
Class: Jellyfin.Server.Migrations.JellyfinMigrationAttribute
Assembly: jellyfin
File(s): /srv/git/jellyfin/Jellyfin.Server/Migrations/JellyfinMigrationAttribute.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 65
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 5/31/2026 - 12:15:44 AM Line coverage: 100% (2/2) Total lines: 6811/13/2026 - 12:19:51 AM Line coverage: 100% (8/8) Branch coverage: 100% (2/2) Total lines: 65 11/13/2026 - 12:19:51 AM Line coverage: 100% (8/8) Branch coverage: 100% (2/2) Total lines: 65

Coverage delta

Coverage delta 1 -1

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%22100%

File(s)

/srv/git/jellyfin/Jellyfin.Server/Migrations/JellyfinMigrationAttribute.cs

#LineLine coverage
 1#pragma warning disable CA1019 // Define accessors for attribute arguments
 2
 3using System;
 4using System.Globalization;
 5using Jellyfin.Server.Migrations.Stages;
 6
 7namespace Jellyfin.Server.Migrations;
 8
 9/// <summary>
 10/// Declares an class as an migration with its set metadata.
 11/// </summary>
 12[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
 13public sealed class JellyfinMigrationAttribute : Attribute
 14{
 15    /// <summary>
 16    /// Initializes a new instance of the <see cref="JellyfinMigrationAttribute"/> class.
 17    /// </summary>
 18    /// <param name="order">The ordering this migration should be applied to. Must be a valid DateTime ISO8601 formatted
 19    /// <param name="name">The name of this Migration.</param>
 270220    public JellyfinMigrationAttribute(string order, string name) : this(order, name, null)
 21    {
 270222    }
 23
 24    /// <summary>
 25    /// Initializes a new instance of the <see cref="JellyfinMigrationAttribute"/> class for legacy migrations.
 26    /// </summary>
 27    /// <param name="order">The ordering this migration should be applied to. Must be a valid DateTime ISO8601 formatted
 28    /// <param name="name">The name of this Migration.</param>
 29    /// <param name="key">[ONLY FOR LEGACY MIGRATIONS]The unique key of this migration. Must be a valid Guid formatted s
 441230    public JellyfinMigrationAttribute(string order, string name, string? key)
 31    {
 441232        Order = DateTime.Parse(order, CultureInfo.InvariantCulture);
 33        Name = name;
 441234        Stage = JellyfinMigrationStageTypes.AppInitialisation;
 441235        if (key is not null)
 36        {
 171037            Key = Guid.Parse(key);
 38        }
 441239    }
 40
 41    /// <summary>
 42    /// Gets or Sets a value indicating whether the annoated migration should be executed on a fresh install.
 43    /// </summary>
 44    public bool RunMigrationOnSetup { get; set; }
 45
 46    /// <summary>
 47    /// Gets or Sets the stage the annoated migration should be executed at. Defaults to <see cref="JellyfinMigrationSta
 48    /// </summary>
 49    public JellyfinMigrationStageTypes Stage { get; set; } = JellyfinMigrationStageTypes.CoreInitialisation;
 50
 51    /// <summary>
 52    /// Gets the ordering of the migration.
 53    /// </summary>
 54    public DateTime Order { get; }
 55
 56    /// <summary>
 57    /// Gets the name of the migration.
 58    /// </summary>
 59    public string Name { get; }
 60
 61    /// <summary>
 62    /// Gets the Legacy Key of the migration. Not required for new Migrations.
 63    /// </summary>
 64    public Guid? Key { get; }
 65}