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_metaprojectsentriesattachmentsattachment_chunkscommitscommit_parentsdevice_headsbranchesobject_versionstombstonessnapshotskey_epochsconflicts
3. Key constraints
entries.project_idmust referenceprojects.project_id.attachments.project_idis mandatory.attachments.entry_idis optional but if present must referenceentries.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
