dexie-migrationlisted
Install: claude install-skill anchit-choudhry/gryffin-calorai
# Dexie Schema Migration
You are performing a Dexie IndexedDB schema migration for Gryffin Calorai.
**STOP before starting:** confirm the user knows that IndexedDB migrations are irreversible in
production. Once a version ships, that version number can never be reused.
## Step 1 - Gather requirements
Ask the user:
1. What is being added? (new table / new column on existing table / new index)
2. Does the change require an upgrade callback? (yes if existing rows need backfilling)
3. What TypeScript interface change is needed? (new field, new table type)
## Step 2 - Determine new version number
Read `apps/web/src/db/dbService.ts` and find the highest `db.version(N)` call. The new version is
N+1.
Current schema is v19 (B4 Cloud Sync baseline). Update the `DB_SCHEMA_VERSION` constant if one
exists; otherwise track manually.
## Step 3 - Copy the full stores schema
**CRITICAL:** Dexie requires EVERY table to be listed in EVERY `db.version().stores({})` call, even
if unchanged. Omitting a table from a version block drops it.
Copy the full stores object from the previous version block and add your changes on top.
**Schema syntax reminders:**
- `++id` = auto-increment integer PK
- `&field` = unique index
- `[a+b]` = compound index (required for `userId+dateLogged` query pattern)
- Listing a field adds an index; omitting it still stores the field, just unindexed
- Only index fields you will actually query by
## Step 4 - Write the version block
**Without upgrade callback (