# DO-004 — Ratify IDB Schema v2 (6 stores)

**Date:** 2026-06-29
**Status:** Locally binding via OSCR-

---

## Decision

Oscar ratifies the IDB schema v2 as the constitutional persistence layer.

## Schema (constitutional)

```
DB_VERSION: 2

Stores (6):
- trees: Tree records (id, survey_id, species, height_m, age_class, condition, retention_category A|B|C|U, ...)
- sites: Site records
- surveys: Survey records (status: draft|active|archived, ...)
- notes: Note records (body, status, tags[])
- reports: Report records (body markdown, survey_id, status)
- posts: BlogPost records (added Phase 10, DB_VERSION bump 1→2)

Per-store namespacing: oscar-trees, oscar-surveys, oscar-notes, oscar-reports, oscar-posts, oscar-sites.
```

## Migration policy

- v1 → v2: Add `posts` store. Existing records unchanged. (Phase 10 migration, applied 2026-06.)
- Future versions: bump DB_VERSION; provide upgrade() migration logic.

## Cross-references

- `app/src/data/persistence/idb.ts`
- `pact/codex/data.codex.md` C9.3 (IDB constitutional schema)
- `pact/fragments/oscar.data.persistence.idb.001`

