CoolFace
Apppublic

fmatituy/selectospromanager

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
migrate_plan_accion.py26 linesDownload Raw Back to database
1import sqlite32import os3 4DB_PATH = 'pro_manager.db'5 6def migrate():7    if not os.path.exists(DB_PATH):8        print("DB not found")9        return10    11    conn = sqlite3.connect(DB_PATH)12    c = conn.cursor()13    14    for col, ctype in [('investigacion_id', 'INTEGER'), ('actividad', 'TEXT')]:15        try:16            c.execute(f"ALTER TABLE sst_plan_accion ADD COLUMN {col} {ctype}")17            print(f"Added column {col}")18        except Exception as e:19            print(f"Column {col} might already exist or error: {e}")20            21    conn.commit()22    conn.close()23 24if __name__ == "__main__":25    migrate()26