Skip to content

MDBX SQLite Schema v1

Version: MDBX-1-DRAFT

Defines the first logical schema for the SQLite + custom encryption layer route.

1. Goals

Schema v1 must support:

  • project-centered organization
  • entry ownership by project
  • first-class attachments
  • commit history
  • tombstones
  • snapshot/recovery
  • future KDBX import/export

2. Mandatory tables (v1)

  • vault_meta
  • projects
  • entries
  • attachments
  • attachment_chunks
  • commits
  • commit_parents
  • device_heads
  • branches
  • object_versions
  • tombstones
  • snapshots
  • key_epochs
  • conflicts

3. Key constraints

  • entries.project_id must reference projects.project_id.
  • attachments.project_id is mandatory.
  • attachments.entry_id is optional but if present must reference entries.entry_id.
  • sensitive fields must remain encrypted payload columns, not plaintext columns.
  • attachment rename must not alter content_hash.

4. Index guidance

Recommended indexes cover update time, ownership lookups, deleted flags, content hash, and commit lineage traversal.

5. Acceptance checklist

  • schema can be created and migrated
  • project/entry/attachment ownership is enforced
  • history and conflict tables can represent DAG and unresolved conflicts
  • snapshot and tombstone paths are representable
最近更新