- New task_blockers join table (many-to-many, cross-project)
- Cycle detection prevents circular dependencies
- GET /api/tasks/{id}/blockers and /blocking endpoints
- POST/DELETE /api/tasks/{id}/blockers/{blocker_id}
- GET /api/actionable — all non-done tasks with no incomplete blockers
- BlockerPanel.jsx — search & manage blockers per task (via task menu)
- ActionableView.jsx — "what can I do right now?" dashboard grouped by project
- "Now" button in nav header routes to actionable view
- migrate_add_blockers.py migration script for existing databases
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""
|
|
Migration script to add the task_blockers association table.
|
|
Run this once if you have an existing database.
|
|
|
|
Usage (from inside the backend container or with the venv active):
|
|
python migrate_add_blockers.py
|
|
"""
|
|
import sqlite3
|
|
import os
|
|
|
|
db_path = os.path.join(os.path.dirname(__file__), 'bit.db')
|
|
|
|
if not os.path.exists(db_path):
|
|
print(f"Database not found at {db_path}")
|
|
print("No migration needed — new database will be created with the correct schema.")
|
|
exit(0)
|
|
|
|
conn = sqlite3.connect(db_path)
|
|
cursor = conn.cursor()
|
|
|
|
try:
|
|
# Check if the table already exists
|
|
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='task_blockers'")
|
|
if cursor.fetchone():
|
|
print("Table 'task_blockers' already exists. Migration not needed.")
|
|
else:
|
|
cursor.execute("""
|
|
CREATE TABLE task_blockers (
|
|
task_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
|
blocked_by_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
|
PRIMARY KEY (task_id, blocked_by_id)
|
|
)
|
|
""")
|
|
conn.commit()
|
|
print("Successfully created 'task_blockers' table.")
|
|
except Exception as e:
|
|
print(f"Error during migration: {e}")
|
|
conn.rollback()
|
|
finally:
|
|
conn.close()
|