#!/usr/bin/env python3 """ Script to standardize all Kanban boards with the 4 default columns: - ToDo - In Progress - Waiting - Done This script will: 1. Find all existing Kanban boards 2. Delete all existing columns for each board 3. Create the 4 standard columns in the correct order """ import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from sqlmodel import Session, select from app.database import engine from app.models import KanbanBoard, KanbanColumn def standardize_kanban_boards(): """Standardize all Kanban boards with default columns""" with Session(engine) as session: # Get all boards boards = session.exec(select(KanbanBoard)).all() print(f"Found {len(boards)} Kanban boards to standardize") default_columns = [ ("ToDo", 0), ("In Progress", 1), ("Waiting", 2), ("Done", 3) ] for board in boards: print(f"Processing board: {board.name} (ID: {board.id})") # Delete all existing columns for this board existing_columns = session.exec( select(KanbanColumn).where(KanbanColumn.board_id == board.id) ).all() if existing_columns: print(f" Deleting {len(existing_columns)} existing columns") for column in existing_columns: session.delete(column) session.commit() # Create the 4 standard columns print(" Creating 4 standard columns") for name, position in default_columns: new_column = KanbanColumn( board_id=board.id, name=name, position=position ) session.add(new_column) session.commit() print(f" āœ“ Board {board.name} standardized") print(f"\nāœ… Successfully standardized {len(boards)} Kanban boards") print("All boards now have the 4 standard columns: ToDo, In Progress, Waiting, Done") if __name__ == "__main__": standardize_kanban_boards()