Changelog: Curiosus.Migrations
[Unreleased]
Added
MigrationExceptionis public: thrownew MigrationException(errorCode, message)(or with an inner exception) from a custom connection, migrations provider or migration to fail the migration with a specificMigrationErrorCode.MigrationResult.Exceptionholds the exception that failed the migration, and aMigrationResult.CreateFailed(errorCode, errorMessage, failedMigration, exception)overload takes it.MigrationErrorCode.Cancelledfor migrations cancelled with the cancellation token.IDowngradeMigration.IsDowngradeTransactionRequired: whether the downgrade runs in a transaction, by default the same asIsTransactionRequired. Script migrations set it with theTRANSACTIONdirective of the downgrade script.
Changed
- Cancelling the token passed to
UpgradeDatabaseAsync/DowngradeDatabaseAsyncreturns a failed result with the newMigrationErrorCode.Cancelledand theOperationCanceledExceptioninMigrationResult.Exception, instead ofMigratingErrororUnknownError. An error that happens while the token is cancelled but isn't caused by the cancellation is still reported with its own code. If you treatedMigratingErrororUnknownErrorof a cancelled run as cancellation, check forMigrationErrorCode.Cancelledinstead.
Fixed
- The
UnknownErrorresult message includes the message of the exception that caused it. - A
MigrationExceptionthrown by a pre-migration keeps itsErrorCodein the result instead ofMigratingError. - Script directives written with spaces, as in the documentation (
-- CURIOSUS: TRANSACTION = OFF), threw "Option ... is unknown". Spaces around the option name,=and the value are allowed now, and a directive on the last line of a script without a line break is no longer ignored. - A migration with both
.up.sqland.down.sqlscripts took its directives and comment from whichever file was read last, which depends on the file system. NowLONG-RUNNINGandDEPENDENCIEScome from the upgrade script (a warning is logged when the downgrade script declares different ones),TRANSACTIONapplies per direction: the downgrade script inherits the upgrade setting unless it declares its own, so aDROP INDEX CONCURRENTLYrollback can run outside a transaction. The comment comes from the upgrade script, or from the downgrade script when the upgrade script has none. Script files are read in ordinal name order. - Directives were parsed with the current culture, so lower-case directives failed under the Turkish culture.
- The error for an incorrect
DEPENDENCIESvalue names the value that failed to parse.
[6.0.0] - 2026-09-29
Changed
- Breaking: dropped
net8.0and thenetstandard2.0,netstandard2.1,netcoreapp3.1,net6.0andnet7.0targets. Supported targets arenet9.0andnet10.0: stay on 5.x for older runtimes. Microsoft.Extensions.DependencyInjection,.DependencyInjection.AbstractionsandLogging.Abstractions10.0.0: the lowest version of the latest major, your application may use any later 10.x.
[5.0.0] - 2026-09-28
Changed
- Breaking: package renamed from
Curiosity.MigrationstoCuriosus.Migrationsand now published by the curiosus-dev organization. Namespaces, assemblies and types were renamed accordingly (Curiosity*→Curiosus*): replaceCuriositywithCuriosusin your code to migrate.
Added
- Script migration directives accept the
-- CURIOSUS:prefix. The-- CURIOSITY:prefix is still supported, existing scripts don't need to be changed.
[4.4.0] - 2026-02-13
Changed
- Upgraded MS packages to
10.*version. - Added net10.0, net9.0 and net8.0 targets.
[4.3.1] - 2025-05-01
Added
- Added database name to
MigrationException.
[4.3.0] - 2023-11-14
Added
- Migration dependencies: ability to specify how one migration depends from another. Both code and script migrations supports this.
[4.2.0] - 2023-04-21
Changed
- Improved detecting incorrect migration files names.
[4.1.3] - 2023-04-14
Changed
- Renamed cancellation token param.
[4.1.2] - 2023-04-12
Fixed
- Fixed processing script migrations prefix.
[4.1.1] - 2023-04-12
Fixed
- Fixed migrations order at engines constructor.
[4.1.0] - 2023-04-12
Added
- Added
ScriptIncorrectNamingActionforScriptProviderto specify what should migrator do with scripts with incorrect name.
[4.0.1] - 2023-04-10
Added
- Added README.md to a package.
Changed
- Downgraded MS packages to
6.0.0version.
[4.0.0] - 2023-04-10
Added
- Added more comments.
- Added options to
ServiceCollectionExtensions.AddMigrationsto control whether current instance of IServiceCollection should be used as default for dependency injection of migrator. - Added
onlyTargetVersionoption. - Added saving initial version format (before parse changes).
Changed
- Upgraded to C# 11.0.
- Refactored
MigrationPolicy, changed existed enum values codes: improved extensibility for future changes. - Renamed
MigrationError->MigrationErrorCode. - Refactored
MigrationErrorCode, changed existed enum values codes: improved extensibility for future changes. - #22: Forbid to use
-at version's major part. Replaced it by_. - #27: Replaced
MigrateAsyncby explicitUpgradeDatabaseAsyncandDowngradeDatabaseAsyncmethods. - #28: Renamed
DbVersion->MigrationVersion.
Removed
- Removed
Dapperdependency. - Moved
MassUpdateCodeMigrationBasetoCuriosity.Migration.Utilspackage.
Fixed
- #22: Fixed issue with parsing version like
20210916-1055-00.
[3.1.0] - 2022-07-29
Added
- Added
MassUpdateCodeMigrationBasefor mass updates.
[3.0.7] - 2022-04-21
Added
- Added option to disabling warn about incorrect script migrations naming.
[3.0.6] - 2022-03-01
Fixed
- Fixed log message.
[3.0.5] - 2022-03-01
Fixed
- Fixed applying migrations via patch strategy.
[3.0.4] - 2021-08-03
Changed
- Fixed transaction block parsing.
[3.0.3] - 2021-03-08
Changed
- Updated package info.
[3.0.2] - 2020-12-10
Changed
- Changed level of log for incorrect migration name from
WarningtoDebug.
[3.0.1] - 2020-12-09
Fixed
- Version parsing.
[3.0.0] - 2020-12-08
Changed
- Code style fixes.
- Changed migration applying strategy from sequential to patch.
Removed
- DB state method.
- Major and minor migration polices.
[2.2] - 2020-10-16
Fixed
- Exceptions occurred during upgrade or downgrade were logged twice.
[2.1] - 2020-09-21
Added
- Options for each migration. First option is switching of transaction for specific migration.
--CURIOSITY:Transactions=off
Changed
- Upgraded to C# 8.0.
[2.0] - 2020-05-14
Changed
- Split downgrade migrations into another interface for safety reasons.
- Default
downgrade policyisForbidden. - Supports different strategy for migration history table analysis.
[1.2.0] - 2020-04-23
Added
- Added logging of sql queries.
Removed
- Removed dependency from
JetBrains.Annotations.
[1.1.1] - 2020-04-01
Added
- Added extended logging for main migration process.
- Added cancellation token to pre-migrations.
[1.1] - 2020-03-24
- Added cancellation token support.
- Fixed batches creation when creating an empty batch as the first one.
[1.0] - 2020-02-11
Moved to SIIS Ltd.
- #6 Added support of batches inside script migrations.
- #7 Added running script migration name to log output.
- #8 Migration history table now really contains migrations history.
- #9 Check correctness of current db version before migrations start.
[0.4] - 2019-10-31
Added
- #13 Creating code migration from service collection.
- Extension method
AddMigrationto easy configure migration. - Passing logger to code migration.
[0.3.2] - 2019-10-31
Added
- Added method
ExecuteNonQueryScriptAsynctoIDbProvider.
[0.3.1] - 2019-09-16
Fixed
- Passing variables to code migrations.
[0.3] - 2019-09-16
Added
- Variables for scripts with auto substitution to script migrations.
[0.2.16] - 2018-12-19
Added
- Supports bath absolute and relative path for directories in code migrations provider.
- Supports prefix for code migration provider.
[0.2.15] - 2018-12-18
Fixed
- Returned
UseScriptPreMigrations.
[0.2.14] - 2018-12-18
Added
- Support script migrations embedded into specified assembly.
- FluentAPI style for migrations providers.
- Script migrations providers supports many directories as targets.
[0.2.13] - 2018-12-17
Changed
- Fixing incorrect contracts in a Nuget package.
[0.2.12] - 2018-12-17
Changed
- Using
DbTransactioninsteadComittableTransaction.
[0.2.11] - 2018-12-17
Added
- Each migration executed in transaction.
[0.2.10] - 2018-11-30
Fixed
- Executing current version migration downgrade, stopping executing on target version.
[0.2.9] - 2018-11-15
Fixed
- Error on check db version before pre-migrations.
[0.2.8] - 2018-11-09
Added
- Added property
ConnectionStringtoIDbProvider.
[0.2.7] - 2018-11-07
Fixed
- Error logging.
[0.2.6] - 2018-11-07
Changed
- Open connection after creating database.
[0.2.5] - 2018-11-07
Fixed
- Fixed release notes link in nuget package.
[0.2.4] - 2018-11-07
Changed
- Creating
MigrationHistorytable after executing pre-migrations.
[0.2.3] - 2018-11-06
Added
MigrationHistoryTableNameavailable as property ofIDbProvider
[0.2.2] - 2018-11-02
Fixed
- Fixed nuget package target.
[0.2.1] - 2018-11-02
Added
- Additional methods to check database and table existence.
[0.2] - 2018-11-02
Added
- Added pre-migration scripts
- Added options for
IDbProviderand factory to createIDbProvider.