Commit Graph

1 Commits

Author SHA1 Message Date
Tobi Lutke
5f68faa853
Migrate documents table to use collection names instead of IDs
Schema changes:
- documents.collection_id (INTEGER FK) → documents.collection (TEXT)
- Update UNIQUE constraint to (collection, path)
- Update indices to use collection name
- Update FTS triggers to compute filepath from collection || '/' || path

Code changes in store.ts:
- Change all function parameters from collectionId: number to collectionName: string
- Update all SQL queries to use d.collection instead of d.collection_id
- Remove unnecessary JOINs where collection name is already available
- Update DocumentResult type: collectionId → collectionName
- Update renameCollection() to also update documents.collection

Successfully migrated 2309 documents across 6 collections.

This prepares for YAML-based collection configuration where collections
table will be removed and collection names will be the primary identifier.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-13 10:08:24 -05:00