from src.services.postgresql_manager import PostgreSQLManager from src.utils.config import config from src.models.activity import Activity from sqlalchemy import text def backfill(): print("Backfilling is_estimated_power defaults...") db_manager = PostgreSQLManager(config.DATABASE_URL) with db_manager.get_db_session() as session: # Update all NULLs to False result = session.execute( text("UPDATE activities SET is_estimated_power = false WHERE is_estimated_power IS NULL") ) session.commit() print(f"Updated {result.rowcount} rows.") if __name__ == "__main__": backfill()