kindergarten_java/reading-platform-java/clean-flyway.ps1
En 6e11c874d2 chore: 忽略 target 目录和 .class 文件
- 添加 target/ 到 .gitignore
- 从 git 暂存区移除已追踪的 target 目录

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 16:50:54 +08:00

32 lines
1013 B
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 清理 Flyway 迁移历史的 PowerShell 脚本
# 使用 MySQL Connector/NET 执行 SQL
$mysqlExe = "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe"
# 如果 mysql.exe 不存在,尝试其他常见路径
if (!(Test-Path $mysqlExe)) {
$mysqlExe = "C:\Program Files\MySQL\MySQL Workbench 8.0\mysql.exe"
}
if (!(Test-Path $mysqlExe)) {
Write-Host "未找到 MySQL 客户端,请手动执行以下 SQL"
Write-Host ""
Write-Host "USE reading_platform;"
Write-Host "DROP TABLE IF EXISTS flyway_schema_history;"
Write-Host ""
exit 1
}
Write-Host "正在清理 Flyway 迁移历史..."
Write-Host "MySQL 路径:$mysqlExe"
$sql = "USE reading_platform; DROP TABLE IF EXISTS flyway_schema_history; SELECT '清理完成' AS status;"
& $mysqlExe -h 8.148.151.56 -u root -p"reading_platform_pwd" -e $sql
if ($LASTEXITCODE -eq 0) {
Write-Host "清理成功!" -ForegroundColor Green
} else {
Write-Host "清理失败,请检查数据库连接" -ForegroundColor Red
}