komga/scripts/fix_remaining_errors.py
duong.doan1 36ab2efc54 test: Add scripts folder and PostgreSQL test configuration
- Move migration conversion scripts to scripts/ folder
- Create application-postgresql.yml for PostgreSQL testing
- Fix ktlint trailing space error in build.gradle.kts
- Test SQLite backend successfully (runs on port 25600)
- Test PostgreSQL connection (authentication fixed, but migration timeout)
2026-04-07 14:54:48 +07:00

52 lines
1.5 KiB
Python

#!/usr/bin/env python3
import re
import os
def fix_file(file_path):
with open(file_path, "r") as f:
content = f.read()
# Fix all occurrences of SqliteUdfDataSource.COLLATION_UNICODE_3
# More robust pattern to match any whitespace
old_content = content
# Pattern for .collate(SqliteUdfDataSource.COLLATION_UNICODE_3)
# Match any whitespace between .collate and (
content = re.sub(
r"\.collate\s*\(\s*SqliteUdfDataSource\.COLLATION_UNICODE_3\s*\)",
r".apply { jooqUdfHelper.run { collateUnicode3() } }",
content,
)
# Alternative: if the above doesn't work, try simpler replacement
if old_content == content:
# Try simpler pattern
content = content.replace(
"SqliteUdfDataSource.COLLATION_UNICODE_3", "jooqUdfHelper"
)
# Also need to handle the field before .collate
# Actually, we need to wrap the whole expression
# Let's do a different approach: find and replace manually
# Write back
with open(file_path, "w") as f:
f.write(content)
print(f"Processed {file_path}")
return old_content != content
def main():
files = [
"/Users/duong/Documents/GitHub/komga/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookSearchHelper.kt",
"/Users/duong/Documents/GitHub/komga/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesSearchHelper.kt",
]
for file_path in files:
fix_file(file_path)
if __name__ == "__main__":
main()