Files
inquiry_robot/deploy/_remote_count_ag_tables.ps1
T

22 lines
1.1 KiB
PowerShell

# Count ag_ business tables + prefixes in old jeecg-boot.
$ErrorActionPreference = "Continue"
$mysql = "C:\yutongda\tools\mysql-8.0.39-winx64\bin\mysql.exe"
$j = Get-Content "C:\yutongda\secure\application-database-credentials.json" -Raw | ConvertFrom-Json
$h = [string]$j.mysql_host
$u = [string]$j.mysql_username
$p = [string]$j.mysql_password
$out = & $mysql -h $h -P 3306 -u $u "-p$p" --batch -N -e "SELECT table_name FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE' ORDER BY table_name" 2>&1 |
ForEach-Object {"$_".Trim()} | Where-Object { $_ -ne "" -and $_ -notmatch "Warning" }
Write-Output ("total=" + $out.Count)
$ag = @($out | Where-Object { $_ -like 'ag_*' })
Write-Output ("ag_business=" + $ag.Count)
Write-Output ("sys_=" + @($out | Where-Object { $_ -like 'sys_*' }).Count)
Write-Output ("onl_=" + @($out | Where-Object { $_ -like 'onl_*' }).Count)
Write-Output ("jimu_=" + @($out | Where-Object { $_ -like 'jimu_*' }).Count)
Write-Output ("quartz=" + @($out | Where-Object { $_ -like 'qrtz_*' -or $_ -like 'QRTZ_*' }).Count)
Write-Output "=== ag_ tables ==="
$ag | ForEach-Object { $_ }
Write-Output "DONE"