Files
inquiry_robot/deploy/_remote_classify_inquiry_robot_tables.ps1
T

43 lines
1.6 KiB
PowerShell

# Classify tables in inquiry_robot: core vs demo. No secrets.
$ErrorActionPreference = "Continue"
$mysql = "C:\yutongda\tools\mysql-8.0.39-winx64\bin\mysql.exe"
$envFile = "E:\wwwroot\.env"
$hostn = "10.206.0.15"; $user = "inquiry_robot"; $pass = $null; $db = "inquiry_robot"
Get-Content $envFile | ForEach-Object {
if ($_ -match '^MYSQL_HOST=(.+)$') { $hostn = $Matches[1].Trim() }
if ($_ -match '^MYSQL_USER=(.+)$') { $user = $Matches[1].Trim() }
if ($_ -match '^MYSQL_PASSWORD=(.+)$') { $pass = $Matches[1].Trim() }
if ($_ -match '^MYSQL_DB=(.+)$') { $db = $Matches[1].Trim() }
}
$out = & $mysql -h $hostn -P 3306 -u $user "-p$pass" --batch -N $db -e "SHOW TABLES" 2>&1
$tables = $out | ForEach-Object {"$_".Trim()} | Where-Object { $_ -ne "" -and $_ -notmatch "Warning" }
Write-Output ("total=" + $tables.Count)
$demo = @()
$coreSys = @()
$online = @()
$quartz = @()
$jimu = @()
$other = @()
foreach ($t in $tables) {
if ($t -match '^(ceshi_|demo_|test_|jeecg_demo|sys_gateway_route)') { $demo += $t }
elseif ($t -match '^(onl_|online_)') { $online += $t }
elseif ($t -match '^(QRTZ_|qrtz_)') { $quartz += $t }
elseif ($t -match '^(jimu_|jmreport)') { $jimu += $t }
elseif ($t -match '^(sys_|design_|oss_|rep_)') { $coreSys += $t }
else { $other += $t }
}
Write-Output ("core_sys=" + $coreSys.Count)
Write-Output ("online=" + $online.Count)
Write-Output ("quartz=" + $quartz.Count)
Write-Output ("jimu=" + $jimu.Count)
Write-Output ("demoish=" + $demo.Count)
Write-Output ("other=" + $other.Count)
Write-Output "=== demoish ==="
$demo | ForEach-Object { $_ }
Write-Output "=== other ==="
$other | ForEach-Object { $_ }
Write-Output "DONE"