94 lines
3.0 KiB
PowerShell
94 lines
3.0 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Scaffolds EF Core DbContext, entities, and compiled models for all StellaOps modules.
|
|
|
|
.DESCRIPTION
|
|
Iterates through all configured modules and runs Scaffold-Module.ps1 for each.
|
|
Use this after schema changes or for initial setup.
|
|
|
|
.PARAMETER SkipMissing
|
|
Skip modules whose projects don't exist yet (default: true)
|
|
|
|
.EXAMPLE
|
|
.\Scaffold-AllModules.ps1
|
|
|
|
.EXAMPLE
|
|
.\Scaffold-AllModules.ps1 -SkipMissing:$false
|
|
#>
|
|
param(
|
|
[bool]$SkipMissing = $true
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
# Module definitions: Module name -> Schema name
|
|
$modules = @(
|
|
@{ Module = "Unknowns"; Schema = "unknowns" },
|
|
@{ Module = "PacksRegistry"; Schema = "packs" },
|
|
@{ Module = "Authority"; Schema = "authority" },
|
|
@{ Module = "Scanner"; Schema = "scanner" },
|
|
@{ Module = "Scheduler"; Schema = "scheduler" },
|
|
@{ Module = "TaskRunner"; Schema = "taskrunner" },
|
|
@{ Module = "Policy"; Schema = "policy" },
|
|
@{ Module = "Notify"; Schema = "notify" },
|
|
@{ Module = "Concelier"; Schema = "vuln" },
|
|
@{ Module = "Excititor"; Schema = "vex" },
|
|
@{ Module = "Signals"; Schema = "signals" },
|
|
@{ Module = "Attestor"; Schema = "proofchain" },
|
|
@{ Module = "Signer"; Schema = "signer" }
|
|
)
|
|
|
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$RepoRoot = (Get-Item $ScriptDir).Parent.Parent.Parent.FullName
|
|
|
|
Write-Host ""
|
|
Write-Host "============================================================================" -ForegroundColor Cyan
|
|
Write-Host " EF Core Scaffolding for All Modules" -ForegroundColor Cyan
|
|
Write-Host "============================================================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
$successCount = 0
|
|
$skipCount = 0
|
|
$failCount = 0
|
|
|
|
foreach ($m in $modules) {
|
|
$projectPath = Join-Path $RepoRoot "src" $m.Module "__Libraries" "StellaOps.$($m.Module).Persistence.EfCore"
|
|
|
|
if (-not (Test-Path "$projectPath\*.csproj")) {
|
|
if ($SkipMissing) {
|
|
Write-Host "SKIP: $($m.Module) - Project not found" -ForegroundColor DarkGray
|
|
$skipCount++
|
|
continue
|
|
} else {
|
|
Write-Host "FAIL: $($m.Module) - Project not found at: $projectPath" -ForegroundColor Red
|
|
$failCount++
|
|
continue
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host ">>> Scaffolding $($m.Module)..." -ForegroundColor Magenta
|
|
|
|
try {
|
|
& "$ScriptDir\Scaffold-Module.ps1" -Module $m.Module -Schema $m.Schema
|
|
$successCount++
|
|
}
|
|
catch {
|
|
Write-Host "FAIL: $($m.Module) - $($_.Exception.Message)" -ForegroundColor Red
|
|
$failCount++
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "============================================================================" -ForegroundColor Cyan
|
|
Write-Host " Summary" -ForegroundColor Cyan
|
|
Write-Host "============================================================================" -ForegroundColor Cyan
|
|
Write-Host " Success: $successCount"
|
|
Write-Host " Skipped: $skipCount"
|
|
Write-Host " Failed: $failCount"
|
|
Write-Host ""
|
|
|
|
if ($failCount -gt 0) {
|
|
exit 1
|
|
}
|