## Implementation Plan: Add Devlog Timeline of Related Posts to Project Page ### Changes Required 1. **`database/schema.py`** - Add index on `posts.project_uid` in `init_db()` after the table creation block: ```python cursor.execute("CREATE INDEX IF NOT EXISTS idx_posts_project_uid ON posts(project_uid)") ``` - No backfill needed — `project_uid` column already exists with `NULL` default for old posts. 2. **`schemas/listings.py`** - In `ProjectDetailOut`, add a field: ```python project_posts: list[PostSummaryOut] = [] ``` - Import `PostSummaryOut` from `schemas/content.py`. 3. **`routers/projects/index.py`** - In `project_detail()` function, after fetching the project and existing fields, add a query for posts attached to this project: ```python from routers.posts import enrich_items rows = cursor.execute( "SELECT * FROM posts WHERE project_uid = ? AND deleted_at IS NULL ORDER BY created_at DESC LIMIT 50", (project.uid,) ).fetchall() posts = [PostInDB(**row) for row in rows] enriched = enrich_items(cursor, posts) project_dict["project_posts"] = enriched # already serialized ``` - Ensure `ProjectInDB` is imported (likely already present). 4. **`templates/project_detail.html`** - Add a tab button in the tab bar (inside `
No posts yet for this project.
{% endif %}