PostgreSQL: Remove from PATH/Add environment variables. (#1099)

* Removed PostgreSQL server from path.

* Added new Paths

* added another solution for documentation

* Fixed path in generator.
This commit is contained in:
Darii Nurgaleev
2020-06-25 12:20:48 +03:00
committed by GitHub
parent e0c359be4c
commit 32bea7d8d3
3 changed files with 12 additions and 4 deletions
@@ -9,11 +9,17 @@ Set-SystemVariable -SystemVariable PGUSER -Value $pgUser
Set-SystemVariable -SystemVariable PGPASSWORD -Value $pgPwd
#Install latest PostgreSQL
Choco-Install -PackageName postgresql -ArgumentList "--params", "/Password:$pgPwd", "--params-global", "--debug", "--verbose"
Choco-Install -PackageName postgresql -ArgumentList "--params", "/Password:$pgPwd", "/NoPath", "--params-global", "--debug", "--verbose"
#Get Path to pg_ctl.exe
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
#Parse output of command above to obtain pure path
$pgBin = Split-Path -Path $pgPath.split('"')[1]
#Added PostgreSQL bin path into PATH variable
Add-MachinePathItem $pgBin
$pgRoot = Split-Path -Path $pgPath.split('"')[5]
$pgData = Join-Path $pgRoot "data"
#Added PostgreSQL environment variable
Set-SystemVariable -SystemVariable PGBIN -Value $pgBin
Set-SystemVariable -SystemVariable PGROOT -Value $pgRoot
Set-SystemVariable -SystemVariable PGDATA -Value $pgData