collabrix/backend/scripts/standardize_kanban_boards.py
DGSoft a7ff948e7e Beta Release: Complete Kanban system with auto-save, route persistence, and UI improvements
- Added complete Kanban board functionality with drag-and-drop
- Implemented auto-save for Kanban card editing (no more edit button)
- Added route persistence to remember last visited page on reload
- Improved Kanban UI design with slimmer borders and compact layout
- Added checklist functionality for Kanban cards
- Enhanced file upload and direct messaging features
- Improved authentication and user management
- Added toast notifications system
- Various UI/UX improvements and bug fixes
2025-12-10 23:17:07 +01:00

69 lines
2.1 KiB
Python
Executable File

#!/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()