Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

46 lignes
1.7KB

  1. <#
  2. Runs ON the IIS server (invoked over SSH by scripts\run-migrations-remote.ps1). Not meant
  3. to be run by hand except for troubleshooting.
  4. Applies pending migrations to the live database WITHOUT touching the deployed site files:
  5. - Copies the live public\web.config from RemoteDir into WorkDir, so runMigrations.vbs picks
  6. up the real production connection string without it being hard-coded here.
  7. - Runs `runMigrations.vbs status` (for the log) then `up` from WorkDir.
  8. - Deletes WorkDir when done, win or lose - nothing is left behind on the server.
  9. #>
  10. param(
  11. [Parameter(Mandatory = $true)][string]$RemoteDir,
  12. [Parameter(Mandatory = $true)][string]$WorkDir
  13. )
  14. $ErrorActionPreference = 'Stop'
  15. $liveWebConfig = Join-Path $RemoteDir 'public\web.config'
  16. if(!(Test-Path $liveWebConfig)){
  17. throw "No deployed web.config found at $liveWebConfig - is the site actually deployed at -RemoteDir?"
  18. }
  19. $workPublicDir = Join-Path $WorkDir 'public'
  20. New-Item -ItemType Directory -Force -Path $workPublicDir | Out-Null
  21. Copy-Item $liveWebConfig (Join-Path $workPublicDir 'web.config') -Force
  22. try {
  23. Push-Location $WorkDir
  24. Write-Host '-- status before --'
  25. & cscript.exe //nologo scripts\runMigrations.vbs status
  26. if($LASTEXITCODE -ne 0){ throw 'runMigrations.vbs status failed - see output above' }
  27. Write-Host ''
  28. Write-Host '-- applying pending migrations --'
  29. & cscript.exe //nologo scripts\runMigrations.vbs up
  30. if($LASTEXITCODE -ne 0){ throw 'runMigrations.vbs up failed - see output above' }
  31. } finally {
  32. Pop-Location
  33. Write-Host ''
  34. Write-Host "Cleaning up $WorkDir"
  35. Remove-Item -Recurse -Force $WorkDir -ErrorAction SilentlyContinue
  36. }
  37. Write-Host 'Remote migration apply complete.'

Powered by TurnKey Linux.