import sqlite3 import os DB_PATH = r'd:\Documents\trae_projects\yrtv\database\L3\L3_Features.sqlite' def add_columns(): conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() # Check existing columns cursor.execute("PRAGMA table_info(dm_player_features)") columns = [row[1] for row in cursor.fetchall()] new_columns = [ 'score_bat', 'score_sta', 'score_hps', 'score_ptl', 'score_tct', 'score_util', 'bat_avg_duel_win_rate', 'bat_kd_diff_high_elo', 'bat_win_rate_close', 'sta_time_rating_corr', 'sta_fatigue_decay', 'hps_match_point_win_rate', 'hps_comeback_kd_diff', 'hps_pressure_entry_rate', 'ptl_pistol_win_rate', 'ptl_pistol_kd', 'util_avg_flash_enemy' ] for col in new_columns: if col not in columns: print(f"Adding column: {col}") try: cursor.execute(f"ALTER TABLE dm_player_features ADD COLUMN {col} REAL") except Exception as e: print(f"Error adding {col}: {e}") conn.commit() conn.close() print("Schema update complete.") if __name__ == "__main__": if not os.path.exists(DB_PATH): print("L3 DB not found, skipping schema update (will be created by build script).") else: add_columns()