23 lines
1000 B
PowerShell
23 lines
1000 B
PowerShell
# Dump columns of the 5 RBAC tables.
|
|
$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() }
|
|
}
|
|
foreach ($t in @('sys_user','sys_role','sys_user_role','sys_permission','sys_role_permission')) {
|
|
Write-Output ("==== " + $t + " ====")
|
|
$q = "SHOW COLUMNS FROM " + $t
|
|
& $mysql -h $hostn -P 3306 -u $user "-p$pass" --batch -N $db -e $q 2>&1 |
|
|
ForEach-Object {
|
|
if ($_ -match "Warning") { return }
|
|
$p = ("$_") -split "`t"
|
|
if ($p.Count -ge 2) { $p[0] + " | " + $p[1] } else { "$_" }
|
|
}
|
|
}
|
|
Write-Output "DONE"
|