Files
GlowTrack/specs/001-glowtrack-a-mood/contracts/storage.schema.md
Danilo Reyes 2f096d0265 feat: Add GlowTrack mood and habit wellbeing grid specifications
- Introduced export schema for JSON data structure.
- Created renderer contract detailing canvas/SVG rendering requirements.
- Defined IndexedDB storage schema and migration strategies.
- Documented data model including entities and relationships.
- Developed implementation plan outlining execution flow and project structure.
- Provided quickstart guide for development environment setup.
- Compiled research documentation on performance, accessibility, and theming.
- Established feature specification with user scenarios and functional requirements.
2025-09-18 00:36:13 -06:00

940 B

Storage Schema — IndexedDB (idb)

DB Name

  • glowtrack

Versioning

  • Start at version 1; bump on schema changes
  • Provide forward-only migrations for v1 → v2 → ...

Object Stores

  • settings (key: 'singleton')
    • value: GridSettings
  • habits (keyPath: 'id')
    • indexes: by_type (type)
  • days (keyPath: 'date')
    • value: DayTile without entries
  • entries (keyPath: 'id')
    • indexes:
      • by_date (date)
      • by_habit (habitId)

Transactions

  • Log habit: readwrite on entries, days (update netScore)
  • Edit/delete: readwrite on entries, days
  • Import JSON: version check, bulk put within a single transaction per store

Migrations

  • v1: create stores and indexes above
  • Future: add derived caches (e.g., monthly aggregates) — must be rebuildable

Data Integrity

  • Enforce unique DayTile.date
  • Recompute DayTile.netScore after entry mutations
  • Maintain referential link of HabitEntry.habitId to habits store