-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMigrate-Database.ps1
More file actions
30 lines (28 loc) · 894 Bytes
/
Migrate-Database.ps1
File metadata and controls
30 lines (28 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
param([string] $ApplicationPath)
$ErrorActionPreference = 'Stop';
$env:PATH="$env:Path;$env:SystemRoot\system32\inetsrv\"
$MigrationsDll = "Prospa.Xero.Database"
function Migrate-Database {
[CmdletBinding()]
param
(
[Parameter(Position=1, Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ApplicationPath
)
Write-Output -Message ('Running migrations for : {0}' -f $ApplicationPath);
try
{
$apiPath = APPCMD list vdirs $ApplicationPath /text:physicalpath
$binFolder = $apiPath + '\bin'
$migrateExe = $binFolder + '\migrate.exe'
$cmd = "$migrateExe $MigrationsDll /startUpDirectory:$binFolder /startUpConfigurationFile:$binFolder\migrate.exe.config"
Write-Output -Message $cmd
Invoke-Expression $cmd
}
catch
{
throw $_;
}
}
Migrate-Database $ApplicationPath