Initial commit of akmon project
This commit is contained in:
19
doc_eldercare/fix_conflicts.ps1
Normal file
19
doc_eldercare/fix_conflicts.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
# 修复 eldercare_mock_data_insert.sql 中的重复键冲突问题
|
||||
|
||||
$filePath = "h:\blews\akmon\doc_eldercare\eldercare_mock_data_insert.sql"
|
||||
$content = Get-Content $filePath -Raw -Encoding UTF8
|
||||
|
||||
# 查找并替换所有 ak_users INSERT 语句,添加冲突处理
|
||||
$pattern = "(INSERT INTO public\.ak_users.*?)\);"
|
||||
$replacement = '$1)' + "`nON CONFLICT (id) DO NOTHING;"
|
||||
|
||||
$updatedContent = $content -replace $pattern, $replacement
|
||||
|
||||
# 保存更新的文件
|
||||
Set-Content $filePath -Value $updatedContent -Encoding UTF8
|
||||
|
||||
Write-Host "已修复所有 ak_users INSERT 语句的冲突处理"
|
||||
|
||||
# 验证修复结果
|
||||
$conflictCount = ([regex]::Matches($updatedContent, "ON CONFLICT \(id\) DO NOTHING")).Count
|
||||
Write-Host "文件中现在有 $conflictCount 个冲突处理语句"
|
||||
Reference in New Issue
Block a user