Search Results for

    Show / Hide Table of Contents

    Class MigrationRunner

    The default IMigrationRunner implementation

    Inheritance
    object
    MigrationRunner
    Implements
    IMigrationRunner
    IMigrationScopeStarter
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: FluentMigrator.Runner
    Assembly: FluentMigrator.Runner.dll
    Syntax
    public class MigrationRunner : IMigrationRunner, IMigrationScopeStarter

    Constructors

    | Edit this page View Source

    MigrationRunner(IAssemblyCollection, IRunnerContext, IMigrationProcessor, IVersionTableMetaData, IMigrationRunnerConventions)

    Initializes a new instance of the MigrationRunner class.

    Declaration
    [Obsolete]
    public MigrationRunner(IAssemblyCollection assemblies, IRunnerContext runnerContext, IMigrationProcessor processor, IVersionTableMetaData versionTableMetaData = null, IMigrationRunnerConventions migrationRunnerConventions = null)
    Parameters
    Type Name Description
    IAssemblyCollection assemblies

    The collection of assemblies to scan for migrations, etc...

    IRunnerContext runnerContext

    The runner context

    IMigrationProcessor processor

    The migration processor

    IVersionTableMetaData versionTableMetaData

    The version table metadata

    IMigrationRunnerConventions migrationRunnerConventions

    The custom migration runner conventions

    | Edit this page View Source

    MigrationRunner(IAssemblyCollection, IRunnerContext, IMigrationProcessor, IVersionTableMetaData, IMigrationRunnerConventions, IConventionSet, IMigrationScopeManager)

    Initializes a new instance of the MigrationRunner class.

    Declaration
    [Obsolete]
    public MigrationRunner(IAssemblyCollection assemblies, IRunnerContext runnerContext, IMigrationProcessor processor, IVersionTableMetaData versionTableMetaData, IMigrationRunnerConventions migrationRunnerConventions, IConventionSet conventionSet, IMigrationScopeManager migrationScopeHandler = null)
    Parameters
    Type Name Description
    IAssemblyCollection assemblies

    The collection of assemblies to scan for migrations, etc...

    IRunnerContext runnerContext

    The runner context

    IMigrationProcessor processor

    The migration processor

    IVersionTableMetaData versionTableMetaData

    The version table metadata

    IMigrationRunnerConventions migrationRunnerConventions

    The custom migration runner conventions

    IConventionSet conventionSet

    The expression convention set

    IMigrationScopeManager migrationScopeHandler

    The migration scope handler

    | Edit this page View Source

    MigrationRunner(IOptions<RunnerOptions>, IOptionsSnapshot<ProcessorOptions>, IProfileLoader, IProcessorAccessor, IMaintenanceLoader, IMigrationInformationLoader, ILogger<MigrationRunner>, IStopWatch, IMigrationRunnerConventionsAccessor, IAssemblySource, MigrationValidator, IServiceProvider)

    Initializes a new instance of the MigrationRunner class.

    Declaration
    public MigrationRunner(IOptions<RunnerOptions> options, IOptionsSnapshot<ProcessorOptions> processorOptions, IProfileLoader profileLoader, IProcessorAccessor processorAccessor, IMaintenanceLoader maintenanceLoader, IMigrationInformationLoader migrationLoader, ILogger<MigrationRunner> logger, IStopWatch stopWatch, IMigrationRunnerConventionsAccessor migrationRunnerConventionsAccessor, IAssemblySource assemblySource, MigrationValidator migrationValidator, IServiceProvider serviceProvider)
    Parameters
    Type Name Description
    IOptions<RunnerOptions> options

    The migration runner options

    IOptionsSnapshot<ProcessorOptions> processorOptions

    The migration processor options

    IProfileLoader profileLoader

    The profile loader

    IProcessorAccessor processorAccessor

    The migration processor accessor

    IMaintenanceLoader maintenanceLoader

    The maintenance loader

    IMigrationInformationLoader migrationLoader

    The migration loader

    ILogger<MigrationRunner> logger

    The logger

    IStopWatch stopWatch

    The stopwatch

    IMigrationRunnerConventionsAccessor migrationRunnerConventionsAccessor

    The accessor for migration runner conventions

    IAssemblySource assemblySource

    The assemblies to scan for migrations, etc...

    MigrationValidator migrationValidator

    The validator for migrations

    IServiceProvider serviceProvider

    The service provider

    | Edit this page View Source

    MigrationRunner(IOptions<RunnerOptions>, IOptionsSnapshot<ProcessorOptions>, IProfileLoader, IProcessorAccessor, IMaintenanceLoader, IMigrationInformationLoader, ILogger<MigrationRunner>, IStopWatch, IMigrationRunnerConventionsAccessor, IAssemblySource, MigrationValidator, IServiceProvider, IMigrationScopeManager)

    Initializes a new instance of the MigrationRunner class.

    Declaration
    public MigrationRunner(IOptions<RunnerOptions> options, IOptionsSnapshot<ProcessorOptions> processorOptions, IProfileLoader profileLoader, IProcessorAccessor processorAccessor, IMaintenanceLoader maintenanceLoader, IMigrationInformationLoader migrationLoader, ILogger<MigrationRunner> logger, IStopWatch stopWatch, IMigrationRunnerConventionsAccessor migrationRunnerConventionsAccessor, IAssemblySource assemblySource, MigrationValidator migrationValidator, IServiceProvider serviceProvider, IMigrationScopeManager migrationScopeHandler)
    Parameters
    Type Name Description
    IOptions<RunnerOptions> options

    The migration runner options

    IOptionsSnapshot<ProcessorOptions> processorOptions

    The migration processor options

    IProfileLoader profileLoader

    The profile loader

    IProcessorAccessor processorAccessor

    The migration processor accessor

    IMaintenanceLoader maintenanceLoader

    The maintenance loader

    IMigrationInformationLoader migrationLoader

    The migration loader

    ILogger<MigrationRunner> logger

    The logger

    IStopWatch stopWatch

    The stopwatch

    IMigrationRunnerConventionsAccessor migrationRunnerConventionsAccessor

    The accessor for migration runner conventions

    IAssemblySource assemblySource

    The assemblies to scan for migrations, etc...

    MigrationValidator migrationValidator

    The validator for migrations

    IServiceProvider serviceProvider

    The service provider

    IMigrationScopeManager migrationScopeHandler

    THe migration scope handler

    | Edit this page View Source

    MigrationRunner(Assembly, IRunnerContext, IMigrationProcessor)

    Initializes a new instance of the MigrationRunner class.

    Declaration
    [Obsolete]
    public MigrationRunner(Assembly assembly, IRunnerContext runnerContext, IMigrationProcessor processor)
    Parameters
    Type Name Description
    Assembly assembly

    The assembly to scan for migrations, etc...

    IRunnerContext runnerContext

    The runner context

    IMigrationProcessor processor

    The migration processor

    | Edit this page View Source

    MigrationRunner(Assembly, IRunnerContext, IMigrationProcessor, IConventionSet)

    Initializes a new instance of the MigrationRunner class.

    Declaration
    [Obsolete]
    public MigrationRunner(Assembly assembly, IRunnerContext runnerContext, IMigrationProcessor processor, IConventionSet conventionSet)
    Parameters
    Type Name Description
    Assembly assembly

    The assembly to scan for migrations, etc...

    IRunnerContext runnerContext

    The runner context

    IMigrationProcessor processor

    The migration processor

    IConventionSet conventionSet

    The expression convention set

    Properties

    | Edit this page View Source

    CaughtExceptions

    Gets the caught exceptions when SilentlyFail is true

    Declaration
    public IReadOnlyList<Exception> CaughtExceptions { get; }
    Property Value
    Type Description
    IReadOnlyList<Exception>
    | Edit this page View Source

    Conventions

    Gets the migration runner conventions

    Declaration
    public IMigrationRunnerConventions Conventions { get; }
    Property Value
    Type Description
    IMigrationRunnerConventions
    | Edit this page View Source

    CurrentScope

    Gets or sets the currently active migration scope. Setter for IMigrationScopeManager was removed. Setter for this property will throw exception when custom migration scope handler is used

    Declaration
    public IMigrationScope CurrentScope { get; set; }
    Property Value
    Type Description
    IMigrationScope
    Exceptions
    Type Condition
    NotSupportedException

    Thrown when custom IMigrationScopeManager implementation is used

    | Edit this page View Source

    MaintenanceLoader

    Gets the maintenance loader

    Declaration
    public IMaintenanceLoader MaintenanceLoader { get; }
    Property Value
    Type Description
    IMaintenanceLoader
    | Edit this page View Source

    MigrationAssemblies

    Gets the assemblies searched for migrations, profile migrations, etc...

    Declaration
    [Obsolete]
    public IAssemblyCollection MigrationAssemblies { get; }
    Property Value
    Type Description
    IAssemblyCollection
    | Edit this page View Source

    MigrationLoader

    Gets or sets the migration loader to be used by this migration runner

    Declaration
    public IMigrationInformationLoader MigrationLoader { get; set; }
    Property Value
    Type Description
    IMigrationInformationLoader
    | Edit this page View Source

    Processor

    Gets the migration processor used by this runner

    Declaration
    public IMigrationProcessor Processor { get; }
    Property Value
    Type Description
    IMigrationProcessor
    | Edit this page View Source

    ProfileLoader

    Gets or sets the profile loader

    Declaration
    public IProfileLoader ProfileLoader { get; set; }
    Property Value
    Type Description
    IProfileLoader
    | Edit this page View Source

    RunnerContext

    Gets the runner context

    Declaration
    [Obsolete]
    public IRunnerContext RunnerContext { get; }
    Property Value
    Type Description
    IRunnerContext
    | Edit this page View Source

    SilentlyFail

    Gets a value indicating whether exceptions should be caught

    Declaration
    public bool SilentlyFail { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    TransactionPerSession

    Gets a value indicating whether a single transaction for the whole session should be used

    Declaration
    public bool TransactionPerSession { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    VersionLoader

    Gets or sets the version loader

    Declaration
    public IVersionLoader VersionLoader { get; set; }
    Property Value
    Type Description
    IVersionLoader

    Methods

    | Edit this page View Source

    ApplyMaintenance(MigrationStage, bool)

    Apply maintenance changes

    Declaration
    public void ApplyMaintenance(MigrationStage stage, bool useAutomaticTransactionManagement)
    Parameters
    Type Name Description
    MigrationStage stage

    The maintenance stage

    bool useAutomaticTransactionManagement

    true if automatic transaction management should be used

    | Edit this page View Source

    ApplyMigrationDown(IMigrationInfo, bool)

    Revert the migration using the given migration information

    Declaration
    public virtual void ApplyMigrationDown(IMigrationInfo migrationInfo, bool useTransaction)
    Parameters
    Type Name Description
    IMigrationInfo migrationInfo

    The migration information

    bool useTransaction

    true when a transaction for this operation should be used

    | Edit this page View Source

    ApplyMigrationUp(IMigrationInfo, bool)

    Apply the migration using the given migration information

    Declaration
    public virtual void ApplyMigrationUp(IMigrationInfo migrationInfo, bool useTransaction)
    Parameters
    Type Name Description
    IMigrationInfo migrationInfo

    The migration information

    bool useTransaction

    true when a transaction for this migration should be used

    | Edit this page View Source

    ApplyProfiles()

    Apply all matching profiles

    Declaration
    public void ApplyProfiles()
    | Edit this page View Source

    BeginScope()

    Starts a new migration scope

    Declaration
    public IMigrationScope BeginScope()
    Returns
    Type Description
    IMigrationScope

    A new migration scope

    | Edit this page View Source

    Down(IMigration)

    Executes an Down migration

    Declaration
    public void Down(IMigration migration)
    Parameters
    Type Name Description
    IMigration migration

    The migration to execute

    | Edit this page View Source

    ExecuteExpressions(ICollection<IMigrationExpression>)

    Execute each migration expression in the expression collection

    Declaration
    protected void ExecuteExpressions(ICollection<IMigrationExpression> expressions)
    Parameters
    Type Name Description
    ICollection<IMigrationExpression> expressions

    The expressions to execute

    | Edit this page View Source

    HasMigrationsToApplyDown(long)

    Returns true when there are migrations to revert

    Declaration
    public bool HasMigrationsToApplyDown(long version)
    Parameters
    Type Name Description
    long version

    The target version

    Returns
    Type Description
    bool

    true when there are migrations to revert

    | Edit this page View Source

    HasMigrationsToApplyRollback()

    Are there migrations available for a rollback?

    Declaration
    public bool HasMigrationsToApplyRollback()
    Returns
    Type Description
    bool

    true when there are migrations available for a rollback

    | Edit this page View Source

    HasMigrationsToApplyUp(long?)

    Returns true when there are migrations to apply

    Declaration
    public bool HasMigrationsToApplyUp(long? version = null)
    Parameters
    Type Name Description
    long? version

    The target version (or null if the last one should be used)

    Returns
    Type Description
    bool

    true when there are migrations to apply

    | Edit this page View Source

    ListMigrations()

    List all migrations to the logger

    Declaration
    public void ListMigrations()
    | Edit this page View Source

    MigrateDown(long)

    Migrate down to the given version

    Declaration
    public void MigrateDown(long targetVersion)
    Parameters
    Type Name Description
    long targetVersion
    | Edit this page View Source

    MigrateDown(long, bool)

    Revert migrations down to the given targetVersion

    Declaration
    public void MigrateDown(long targetVersion, bool useAutomaticTransactionManagement)
    Parameters
    Type Name Description
    long targetVersion

    The target version that should become the last applied migration version

    bool useAutomaticTransactionManagement

    true if automatic transaction management should be used

    | Edit this page View Source

    MigrateUp()

    Executes all found (and unapplied) migrations

    Declaration
    public void MigrateUp()
    | Edit this page View Source

    MigrateUp(bool)

    Apply migrations

    Declaration
    public void MigrateUp(bool useAutomaticTransactionManagement)
    Parameters
    Type Name Description
    bool useAutomaticTransactionManagement

    true if automatic transaction management should be used

    | Edit this page View Source

    MigrateUp(long)

    Executes all found (and unapplied) migrations up to the given version

    Declaration
    public void MigrateUp(long targetVersion)
    Parameters
    Type Name Description
    long targetVersion
    | Edit this page View Source

    MigrateUp(long, bool)

    Apply migrations up to the given targetVersion

    Declaration
    public void MigrateUp(long targetVersion, bool useAutomaticTransactionManagement)
    Parameters
    Type Name Description
    long targetVersion

    The target migration version

    bool useAutomaticTransactionManagement

    true if automatic transaction management should be used

    | Edit this page View Source

    Rollback(int)

    Rollback the given number of steps

    Declaration
    public void Rollback(int steps)
    Parameters
    Type Name Description
    int steps

    The number of steps to rollback

    | Edit this page View Source

    Rollback(int, bool)

    Rollback the last steps

    Declaration
    public void Rollback(int steps, bool useAutomaticTransactionManagement)
    Parameters
    Type Name Description
    int steps

    The number of migrations to rollback

    bool useAutomaticTransactionManagement

    true if automatic transaction management should be used

    | Edit this page View Source

    RollbackToVersion(long)

    Rollback to a given version

    Declaration
    public void RollbackToVersion(long version)
    Parameters
    Type Name Description
    long version

    The target version to rollback to

    | Edit this page View Source

    RollbackToVersion(long, bool)

    Rollback to a given version

    Declaration
    public void RollbackToVersion(long version, bool useAutomaticTransactionManagement)
    Parameters
    Type Name Description
    long version

    The version to rollback to (exclusive)

    bool useAutomaticTransactionManagement

    true if automatic transaction management should be used

    | Edit this page View Source

    Up(IMigration)

    Executes an Up migration

    Declaration
    public void Up(IMigration migration)
    Parameters
    Type Name Description
    IMigration migration

    The migration to execute

    | Edit this page View Source

    ValidateVersionOrder()

    Validate that there were no missing migration versions

    Declaration
    public void ValidateVersionOrder()
    Remarks

    Throws an exception if a missing migration was found.

    Implements

    IMigrationRunner
    IMigrationScopeStarter
    • Edit this page
    • View Source
    In this article
    Back to top
    Copyright © 2018 Fluent Migrator Project
    Generated by DocFX
    Creative Commons License
    FluentMigrator Documentation by FluentMigrator Project is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.