collabrix/backend/scripts/create_kanban_checklist_tables.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

71 lines
2.3 KiB
Python

#!/usr/bin/env python3
"""
Migration script to create Kanban checklist tables
"""
import sys
import os
# Add parent directory to path to import app modules
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sqlalchemy import text
from app.database import engine
def migrate():
"""Create Kanban checklist tables"""
with engine.connect() as conn:
# Check if tables already exist
result = conn.execute(text("""
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name IN ('kanban_checklist', 'kanban_checklist_item')
"""))
existing_tables = [row[0] for row in result.fetchall()]
if 'kanban_checklist' in existing_tables:
print("✅ Kanban checklist tables already exist")
return
# Create kanban_checklist table
conn.execute(text("""
CREATE TABLE kanban_checklist (
id SERIAL PRIMARY KEY,
card_id INTEGER NOT NULL REFERENCES kanban_card(id) ON DELETE CASCADE,
title VARCHAR NOT NULL,
position INTEGER DEFAULT 0,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
)
"""))
# Create kanban_checklist_item table
conn.execute(text("""
CREATE TABLE kanban_checklist_item (
id SERIAL PRIMARY KEY,
checklist_id INTEGER NOT NULL REFERENCES kanban_checklist(id) ON DELETE CASCADE,
title VARCHAR NOT NULL,
is_completed BOOLEAN DEFAULT FALSE,
position INTEGER DEFAULT 0,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
)
"""))
# Create indexes
conn.execute(text("""
CREATE INDEX idx_kanban_checklist_card_id ON kanban_checklist(card_id)
"""))
conn.execute(text("""
CREATE INDEX idx_kanban_checklist_item_checklist_id ON kanban_checklist_item(checklist_id)
"""))
conn.commit()
print("✅ Kanban checklist tables created successfully")
if __name__ == "__main__":
migrate()