| 12345678910111213141516171819202122232425262728293031 |
- # 统一 Entity 中的 tenant_id 字段名脚本
- $entityFolders = @(
- "d:\DEMONET\server\Plugins\Admin.NET.Plugin.AiDOP\Order\Entity",
- "d:\DEMONET\server\Plugins\Admin.NET.Plugin.AiDOP\Production\Entity"
- )
- $corrected = @()
- foreach ($folder in $entityFolders) {
- if (!(Test-Path $folder)) { continue }
-
- $files = Get-ChildItem -Path $folder -Filter "*.cs"
-
- foreach ($file in $files) {
- $content = Get-Content $file.FullName -Raw
-
- # 检查是否有 TenantId(Pascal命名)的 ColumnName
- if ($content -match 'ColumnName = "TenantId"') {
- # 将 ColumnName = "TenantId" 改为 ColumnName = "tenant_id"
- $content = $content -replace 'ColumnName = "TenantId"', 'ColumnName = "tenant_id"'
-
- [System.IO.File]::WriteAllText($file.FullName, $content, [System.Text.Encoding]::UTF8)
- Write-Host "Corrected: $($file.Name)" -ForegroundColor Green
- $corrected += $file.Name
- }
- }
- }
- Write-Host "`nCorrected $($corrected.Count) files to use 'tenant_id'" -ForegroundColor Cyan
- $corrected | ForEach-Object { Write-Host " - $_" -ForegroundColor Green }
|