Tags

Select a subset of versioned migrations using explicit ordinal names.

Examples use Classic and Fluent tabs. Your choice follows you through the manual.

Tag migration classes

Tags is in DotNetProjects.Migrator. One class can declare multiple names. Choose names for deployment intent such as core or reporting; do not use a tag to hide a dependency that a selected migration still requires.

A reporting migration

Classic

using System;
using System.Data;
using DotNetProjects.Migrator;
using DotNetProjects.Migrator.Framework;

[Migration(2), Tags("reporting")]
public class CreateReportLog : Migration
{
    public override void Up() => Database.AddTable("ReportLog", new Column("Name", DbType.String, 255));
    public override void Down() => Database.RemoveTable("ReportLog");
}

Fluent

using System;
using System.Data;
using DotNetProjects.Migrator;
using DotNetProjects.Migrator.Framework;
using DotNetProjects.Migrator.Framework.Fluent;

[Migration(2), Tags("reporting")]
public class CreateReportLog : FluentMigration
{
    public override void BuildUp(MigrationBuilder migration)
        => migration.Create.Table("ReportLog").WithColumn("Name").AsString(255);
    public override void BuildDown(MigrationBuilder migration)
        => migration.Delete.Table("ReportLog");
}

Choose one authoring style

Configure matching

Select tags on the runner

Classic

runner.Options.Tags.Add("reporting");
runner.Options.TagMatch = TagMatchMode.Any;
runner.MigrateToLastVersion();

Fluent

runner.Options.Tags.Add("reporting");
runner.Options.TagMatch = TagMatchMode.Any;
runner.MigrateToLastVersion();

Shared host · both styles

Any requires at least one selected tag; All requires every selected tag. Matching is ordinal and case-sensitive. Without a tag filter all eligible versioned migrations are selected. Profiles have their own explicit name selection.

Downgrade behavior

Applied versions excluded by the active filter remain applied during downgrade. A filtered run is therefore not a promise that the whole database matches one contiguous global version range. Keep deployment filters stable and inspect the plan before reversing selected changes.