34 lines
1.3 KiB
PowerShell
34 lines
1.3 KiB
PowerShell
|
|
# Final script to remove ClientId from all entity files
|
||
|
|
Write-Host "Final removal of ClientId from entity files..." -ForegroundColor Green
|
||
|
|
|
||
|
|
# Get all .go files in entity directory
|
||
|
|
$entityFiles = Get-ChildItem -Path "app/database/entity" -Recurse -Filter "*.go"
|
||
|
|
|
||
|
|
foreach ($file in $entityFiles) {
|
||
|
|
$content = Get-Content $file.FullName -Raw
|
||
|
|
|
||
|
|
# Skip if file doesn't contain ClientId
|
||
|
|
if ($content -notmatch "ClientId") {
|
||
|
|
continue
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "Processing: $($file.Name)" -ForegroundColor Yellow
|
||
|
|
|
||
|
|
# Remove ClientId field with regex
|
||
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s+`json:"client_id"[^`]*`\s*\n', ''
|
||
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s+`json:"client_id"[^`]*`\s*', ''
|
||
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s*\n', ''
|
||
|
|
$content = $content -replace '\s*ClientId\s+\*uuid\.UUID\s*', ''
|
||
|
|
|
||
|
|
# Remove uuid import if no more uuid usage
|
||
|
|
if ($content -notmatch 'uuid\.') {
|
||
|
|
$content = $content -replace '"github\.com/google/uuid"\s*\n', ''
|
||
|
|
$content = $content -replace 'github\.com/google/uuid\s*\n', ''
|
||
|
|
}
|
||
|
|
|
||
|
|
# Write back to file
|
||
|
|
Set-Content -Path $file.FullName -Value $content -NoNewline
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "Final ClientId removal completed!" -ForegroundColor Green
|