I am using migration.exe with CCNet to update the database on deployment, I am wondering if there is a way to roll back that change if I decide to roll back the published version.
I know there is a way to target the original version: $InitialDatabase, and also way to target a named migration TargetMigration:”AddPostAbstract”. But the name of the migration target will change on each deployment.
Is there any way to target the previous migration, regardless of it’s name?
Rollback in this case will be manual task otherwise you will most probably need to create some custom action which will check target database’s
__MigrationHistorytable and find the name of target migration.$InitialDatabaseis just powershell variable and its value is 0. When working with powershell you can create your own custom$Previousvariable and fill it with some custom powershell script loading migration name from the database.