reworked docker setup
This commit is contained in:
21
docker/SqlCollationSwitcher/SqlCollationSwitcher2.ps1
Normal file
21
docker/SqlCollationSwitcher/SqlCollationSwitcher2.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
param(
|
||||
[string]$compressedFile
|
||||
)
|
||||
|
||||
# Generate file names
|
||||
$uncompressedFile = $compressedFile -replace '\.sql\.gz$', '_uncompressed.sql'
|
||||
$modifiedFile = $compressedFile -replace '\.sql\.gz$', '_modified.sql'
|
||||
$recompressedFile = $compressedFile -replace '\.gz$', '_modified.sql.gz'
|
||||
|
||||
# Decompress .sql.gz file using 7-Zip
|
||||
& "C:\Program Files\7-Zip\7z.exe" x -so $compressedFile | Set-Content -Path $uncompressedFile -Encoding UTF8
|
||||
|
||||
# Replace text using PowerShell
|
||||
(Get-Content $uncompressedFile) -replace "utf8mb4_0900_ai_ci", "utf8mb4_general_ci" | Set-Content $modifiedFile -Encoding UTF8
|
||||
|
||||
# Compress .sql file back to .sql.gz using 7-Zip
|
||||
& "C:\Program Files\7-Zip\7z.exe" a -tgzip $recompressedFile $modifiedFile
|
||||
|
||||
# Cleanup: Optionally, you can remove the uncompressed and modified files if you don't need them anymore
|
||||
#Remove-Item $uncompressedFile
|
||||
#Remove-Item $modifiedFile
|
||||
Reference in New Issue
Block a user