The Schema Vault is ChameleonDB’s core feature for treating schemas as first-class, immutable artifacts with explicit integrity guarantees.Documentation Index
Fetch the complete documentation index at: https://docs.chameleondb.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Unlike traditional databases that treat schema evolution as an auxiliary concern, ChameleonDB governs schemas at runtime through versioning, cryptographic integrity, and automatic verification.The Schema Vault auto-initializes on first migrate with zero configuration required.
The Problem
Modern database systems enforce strong guarantees over data but treat schema evolution informally:- Schema drift happens silently over time
- Migration failures leave databases in unknown states
- Authority for schema changes is implicit, not enforced
- Audit trails are external, incomplete, or missing
- Rollback is manual and error-prone
The Solution
ChameleonDB’s Schema Vault provides: ✅ Immutable schema versions — Tamper-proof with SHA256 hashing✅ Integrity verification — Automatic checks before every operation
✅ Complete audit trail — Append-only log, never deleted
✅ Zero-config vault — Auto-initializes on first migrate
✅ Lineage tracking — Parent version references
Vault Structure
The Schema Vault lives in the.chameleon/vault/ directory:
manifest.json
Tracks the current version and complete version history:versions/
Contains immutable schema snapshots. Once registered, these files are never modified. Examplev001.json:
hashes/
Stores SHA256 hashes for tamper detection. Each version has a corresponding.hash file.
integrity.log
Append-only audit trail recording all vault operations:How It Works
1. Define Your Schema
Create aschema.cham file with versioned entities:
2. Initialize the Vault
The vault is created with
readonly mode by default for security.3. Apply Migration
- Computes SHA256 hash of the schema
- Registers it as version v001
- Saves snapshot to
vault/versions/v001.json - Saves hash to
vault/hashes/v001.hash - Updates
manifest.json - Logs operation to
integrity.log - Applies migration to database
4. Automatic Verification
Every operation verifies integrity:5. Tamper Detection
If someone modifies vault files:Version History
View the complete version history:Workflow
The complete vault registration workflow:Security Model
The vault uses multiple layers of security:- OS Permissions - File access control (0700)
- Hash Integrity - SHA256 tamper detection
- Integrity Modes - Runtime access control (see Integrity Modes)
- Vault Enforcement - No schema bypass in v1.0+
- Audit Trail - Complete forensics
In v1.0+, the Go engine only loads schemas from the vault. Direct file loading is disabled for security.
Migration Registration
Every migration creates a new version:Features
- ✅ Immutable snapshots - Once registered, never modified
- ✅ SHA256 hash verification - Tamper detection on every operation
- ✅ Lineage tracking - Parent version references
- ✅ Automatic registration - On every migrate
- ✅ Complete audit trail - integrity.log never deleted
- ✅ Zero configuration - Auto-initializes on first use
Best Practices
- Never manually edit vault files - Always use
chameleonCLI - Commit vault to version control - Track schema history alongside code
- Set mode password - Protect against unauthorized schema changes
- Review integrity.log regularly - Monitor for unexpected changes
- Use readonly mode in production - Prevent accidental modifications
Commands
Next Steps
- Learn about Integrity Modes for runtime governance
- Understand the Schema Language
- Explore the Architecture