17 lines
664 B
Python
17 lines
664 B
Python
import sys
|
|
sys.path.append('Backend')
|
|
from app.config.database import engine
|
|
from sqlalchemy import text
|
|
|
|
with engine.connect() as conn:
|
|
print("Modifying alasan_tidak_sesuai_* and kerja_tidak_sesuai_* to TEXT...")
|
|
for col in ['kerja_tidak_sesuai_1', 'kerja_tidak_sesuai_2'] + [f'alasan_tidak_sesuai_{i}' for i in range(1, 12)]:
|
|
try:
|
|
conn.execute(text(f"ALTER TABLE tracer_responses MODIFY COLUMN {col} TEXT NULL;"))
|
|
print(f" Modified {col} to TEXT")
|
|
except Exception as e:
|
|
print(f" Error modifying {col}: {e}")
|
|
|
|
conn.commit()
|
|
print("Database schema successfully upgraded to TEXT!")
|