import sqlite3
import os

DB_PATH = "/app/companies_v3_fixed_2.db"

def migrate_personas():
    print(f"Adding new columns to 'personas' table in {DB_PATH}...")
    conn = sqlite3.connect(DB_PATH)
    cursor = conn.cursor()
    
    columns_to_add = [
        ("description", "TEXT"),
        ("convincing_arguments", "TEXT"),
        ("typical_positions", "TEXT"),
        ("kpis", "TEXT")
    ]
    
    for col_name, col_type in columns_to_add:
        try:
            cursor.execute(f"ALTER TABLE personas ADD COLUMN {col_name} {col_type}")
            print(f"  Added column: {col_name}")
        except sqlite3.OperationalError:
            print(f"  Column {col_name} already exists.")
            
    conn.commit()
    conn.close()
    print("Migration complete.")

if __name__ == "__main__":
    migrate_personas()
