FluentMigrator v3.0.0 Release Notes

Release Date: 2018-05-07 // almost 6 years ago
  • ๐Ÿ“š The new documentation is online on https://fluentmigrator.github.io.

    โฌ†๏ธ Upgrade Guide

    โฌ†๏ธ https://fluentmigrator.github.io/articles/guides/upgrades/guide-2.0-to-3.0.html

    What changed?

    ๐Ÿ’ฅ Breaking changes

    • ๐Ÿ‘ #850: Set minimum .NET Framework version to 4.6.1. Older versions aren't supported anymore.
    • โฑ ProcessorOptions.Timeout is now of type System.TimeSpan?
    • ๐Ÿšง MigrationRunner.MaintenanceLoader is now read-only
    • MigrationRunner.CaughtExceptions returns now a IReadOnlyList
    • dotnet-fm is now a global tool and requires at least the .NET Core tooling 2.1-preview2

    โž• Added

    ๐Ÿ›  Fixed

    • #767: Append NULL constraint for custom types for PostgreSQL and SQL Server

    ๐Ÿ—„ Deprecated

    • IAssemblyCollection and all its implementations
    • IAnnouncer and all its implementations
    • IMigrationRunnerConventions.GetMigrationInfo
    • IProfileLoader.ApplyProfiles()
    • IProfileLoader.FindProfilesIn
    • IMigrationProcessorOptions
    • IMigrationProcessorFactory and all its implementations
    • IRunnerContext and RunnerContext, replaced by several dedicated options classes:
      • RunnerOptions are the new RunnerContext (minus some properties extracted into separate option classes)
      • ProcessorOptions for global processor-specific options
      • GeneratorOptions to allow setting the compatibility mode
      • TypeFilterOptions for filtering migrations by namespace
      • AnnouncerOptions to enable showing SQL statements and the elapsed time
      • SelectingProcessorAccessorOptions allows selection of a processor by its identifier
      • SelectingGeneratorAccessorOptions allows selection of a generator by its identifier
      • AppConfigConnectionStringAccessorOptions to allow leading the connection strings from the *.config xml file (deprecated, only for transition to Microsoft.Extensions.Configuration)
    • CompatabilityMode (is now ComatibilityMode)
    • ApplicationContext in various interfaces/classes
    • ManifestResourceNameWithAssembly replaced by ValueTuple
    • MigrationGeneratorFactory
    • MigrationProcessorFactoryProvider
    • ITypeMap.GetTypeMap(DbType, int, int)
    • IDbFactory: Only the implementations will remain
    • Several non-DI constructors

    โž• Additional information

    Connection string handling

    The library assumes that in ProcessorOptions.ConnectionString is either a connection string or
    a connection string identifier. This are the steps to load the real connection string.

    • Queries all IConnectionStringReader implementations
      • When a connection string is returned by one of the readers, then this
        connection string will be used
      • When no connection string is returned, try reading from the next IConnectionStringReader
    • When no reader returned a connection string, then return ProcessorOptions.ConnectionString

    The connection string stored in ProcessorOptions.ConnectionString might be overridden
    by registering the IConnectionStringReader instance PassThroughConnectionStringReader
    as scoped service.

    When no connection string could be found, the SelectingProcessorAccessor returns
    a ConnectionlessProcessor instead of the previously selected processor.

    Instantiating a migration runner

    // Initialize the servicesvar serviceProvider = new ServiceCollection() .AddLogging(lb =\> lb.AddFluentMigratorConsole()) .AddFluentMigratorCore() .ConfigureRunner( builder =\> builder .AddSQLite() .WithGlobalConnectionString(connectionString) .WithMigrationsIn(typeof(AddGTDTables).Assembly)) .BuildServiceProvider();// Instantiate the runnervar runner = serviceProvider.GetRequiredService\<IMigrationRunner\>();// Run the migrationsrunner.MigrateUp();
    

    This adds the FluentMigrator services to the service collection and
    ๐Ÿ”ง configures the runner to use SQLite with the given connection string,
    announcer and migration assembly.

    Now you can instantiate the runner using the built service provider and use
    its functions.