Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
20 lines
617 B
Python
20 lines
617 B
Python
import os
|
|
import glob
|
|
import re
|
|
|
|
versions_dir = os.path.join("alembic", "versions")
|
|
for py_file in glob.glob(os.path.join(versions_dir, "*.py")):
|
|
with open(py_file, "r", encoding="utf-8") as f:
|
|
content = f.read()
|
|
|
|
# Replace sa.String() with sa.String(255)
|
|
# except we don't want to replace sa.String(xx) that already have a length
|
|
new_content = re.sub(r"sa\.String\(\)", "sa.String(255)", content)
|
|
|
|
if new_content != content:
|
|
print(f"Patched {py_file}")
|
|
with open(py_file, "w", encoding="utf-8") as f:
|
|
f.write(new_content)
|
|
|
|
print("Patching complete.")
|