Spaces:
Running
Running
| import sqlite3 | |
| import os | |
| DB_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "musical_master.db") | |
| def migrate(): | |
| conn = sqlite3.connect(DB_PATH) | |
| cursor = conn.cursor() | |
| cursor.execute("PRAGMA table_info(groups)") | |
| columns = [row[1] for row in cursor.fetchall()] | |
| print(f"Columnas en 'groups': {columns}") | |
| if "foto_base64" not in columns: | |
| cursor.execute("ALTER TABLE groups ADD COLUMN foto_base64 TEXT DEFAULT NULL") | |
| print("[OK] Columna 'foto_base64' agregada a 'groups'.") | |
| else: | |
| print("[INFO] Columna 'foto_base64' ya existe en 'groups'.") | |
| conn.commit() | |
| conn.close() | |
| print("[OK] Migracion de grupo background completada.") | |
| if __name__ == "__main__": | |
| migrate() | |