fix(setup): escape DO $$ in PowerShell heredoc

Use escaped $$ delimiters inside the SQL block so PowerShell does not treat them as interpolation and break init_pg on first-run setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-06 17:13:31 +08:00
parent 46745b372f
commit a0264e5e94

View file

@ -45,7 +45,7 @@ $env:PGPASSWORD = $SuperPassword
try {
Write-Host "==> Ensuring role '$NetxUser'"
$roleSql = @"
DO $$
DO `$\$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = '$NetxUser') THEN
CREATE ROLE $NetxUser LOGIN PASSWORD '$NetxPassword';
@ -53,7 +53,7 @@ BEGIN
ALTER ROLE $NetxUser WITH LOGIN PASSWORD '$NetxPassword';
END IF;
END
$$;
`$\$;
"@
Invoke-Psql -Database "postgres" -Sql $roleSql