ps/Modules/Alkami.PowerShell.Database/Public/Invoke-Migrate.ps1

27 lines
905 B
PowerShell
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
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";
}
}
}