-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
35 lines (26 loc) Β· 1.31 KB
/
setup.ps1
File metadata and controls
35 lines (26 loc) Β· 1.31 KB
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
31
32
33
34
35
Write-Host "π SIMAPRO Enterprise Setup Script" -ForegroundColor Cyan
# Check Node
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
Write-Error "Node.js not installed (need >=18)"; exit 1
}
# Check psql
if (-not (Get-Command psql -ErrorAction SilentlyContinue)) {
Write-Error "PostgreSQL psql not installed (need >=12)"; exit 1
}
$env:DB_NAME = if ($env:DB_NAME) { $env:DB_NAME } else { 'simapro_enterprise' }
Write-Host "π¦ Creating database $($env:DB_NAME) (ignore if exists)"
try { psql -U postgres -c "CREATE DATABASE $($env:DB_NAME);" 2>$null } catch { Write-Host "(skip)" }
Write-Host "π¦ Installing backend dependencies"
Push-Location backend; npm install; Pop-Location
Write-Host "π¦ Installing frontend dependencies"
Push-Location frontend; npm install; Pop-Location
Write-Host "π Creating uploads directory"
New-Item -ItemType Directory -Force -Path backend/uploads | Out-Null
Write-Host "ποΈ Running migrations"
Push-Location backend; npm run migrate; Pop-Location
Write-Host "π± Seeding database"
Push-Location backend; npm run seed; Pop-Location
Write-Host "`nπ Setup completed" -ForegroundColor Green
Write-Host "Start backend: cd backend; npm run dev"
Write-Host "Start frontend: cd frontend; npm run dev"
Write-Host "Login with sysadmin / password"