function Invoke-Migrate { <# .SYNOPSIS Invokes running the migrations using FluentMigrator #> [CmdletBinding()] Param( $connectionString, $dbtag, $migrationPath, $context, $version ) process{ if(!$version) { $version = "0"; } Write-Verbose "& $(Join-Path (Get-MigrationRunnerPath) 'Migrate.exe') -conn '$connectionString' -provider 'sqlserver2008' -assembly '$migrationPath' -tag '$dbtag' -context '$context' -version '$version' --timeout=300 | ForEach-Object { if ($_ -match 'migrating') { Write-Host $_; } }"; & (Join-Path (Get-MigrationRunnerPath) "Migrate.exe") -conn "$connectionString" -provider "sqlserver2008" -assembly "$migrationPath" -tag "$dbtag" -context "$context" -version "$version" --timeout=300 | ForEach-Object { if ($_ -match "migrating") { Write-Host $_; } } if (! $?) { Write-Error $_.Exception; throw "migrate failed"; } } }