File size: 797 Bytes
457b685
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
"""
Replace JSONB with JSON for SQLite compatibility.
"""

import sys
import os
from pathlib import Path

# Add backend to path
backend_path = Path(__file__).parent
sys.path.insert(0, str(backend_path))

# Read the translation_openai.py file
model_file = backend_path / "src" / "models" / "translation_openai.py"
content = model_file.read_text(encoding='utf-8')

# Replace all JSONB with JSON
content = content.replace('JSONB', 'JSON')

# Remove JSONB from imports since we're using JSON from sqlalchemy
content = content.replace('from sqlalchemy.dialects.postgresql import UUID, JSONB',
                         'from sqlalchemy.dialects.postgresql import UUID')

# Write back to file
model_file.write_text(content, encoding='utf-8')

print("Fixed JSONB to JSON conversion")