# Count tables in old prod MySQL jeecg-boot (and inquiry_ prefix). $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 function Q([string]$sql) { $out = & $mysql -h $h -P 3306 -u $u "-p$p" --batch -N -e $sql 2>&1 return ($out | ForEach-Object {"$_".Trim()} | Where-Object { $_ -ne "" -and $_ -notmatch "Warning|ERROR" }) } $total = Q "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE'" $inquiry = Q "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE' AND table_name LIKE 'inquiry_%'" $sys = Q "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE' AND table_name LIKE 'sys_%'" $onl = Q "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE' AND table_name LIKE 'onl_%'" $qrtz = Q "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE' AND (table_name LIKE 'qrtz_%' OR table_name LIKE 'QRTZ_%')" $jimu = Q "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE' AND table_name LIKE 'jimu_%'" $other = Q "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='jeecg-boot' AND table_type='BASE TABLE' AND table_name NOT LIKE 'inquiry_%' AND table_name NOT LIKE 'sys_%' AND table_name NOT LIKE 'onl_%' AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'QRTZ_%' AND table_name NOT LIKE 'jimu_%'" Write-Output ("db=jeecg-boot host=" + $h) Write-Output ("total=" + $total) Write-Output ("inquiry_=" + $inquiry) Write-Output ("sys_=" + $sys) Write-Output ("onl_=" + $onl) Write-Output ("quartz=" + $qrtz) Write-Output ("jimu_=" + $jimu) Write-Output ("other=" + $other) Write-Output "DONE"