-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-test-data.ps1
More file actions
23 lines (18 loc) · 809 Bytes
/
run-test-data.ps1
File metadata and controls
23 lines (18 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# PowerShell script to run test-data.sql in the database
# This script handles the file input correctly for PowerShell
$sqlFile = "src/main/resources/test-data.sql"
if (-not (Test-Path $sqlFile)) {
Write-Host "Error: $sqlFile not found!" -ForegroundColor Red
exit 1
}
Write-Host "Running test-data.sql in database..." -ForegroundColor Cyan
Write-Host "File: $sqlFile" -ForegroundColor Gray
Write-Host ""
# Use Get-Content to read the file and pipe it to docker exec
Get-Content $sqlFile | docker exec -i skillswap-db psql -U postgres -d skillswap
if ($LASTEXITCODE -eq 0) {
Write-Host "`n[SUCCESS] Test data loaded successfully!" -ForegroundColor Green
} else {
Write-Host "`n[ERROR] Error loading test data. Check the error messages above." -ForegroundColor Red
exit $LASTEXITCODE
}