Skip to main content
The Schema Vault is ChameleonDB’s core feature for treating schemas as first-class, immutable artifacts with explicit integrity guarantees.

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. Example v001.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:
The integrity.log is never deleted. It provides complete forensics for compliance and debugging.

How It Works

1. Define Your Schema

Create a schema.cham file with versioned entities:

2. Initialize the Vault

The vault is created with readonly mode by default for security.

3. Apply Migration

This automatically:
  • 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:
Integrity violations always abort operations. This is a critical safety feature.

Version History

View the complete version history:

Workflow

The complete vault registration workflow:

Security Model

The vault uses multiple layers of security:
  1. OS Permissions - File access control (0700)
  2. Hash Integrity - SHA256 tamper detection
  3. Integrity Modes - Runtime access control (see Integrity Modes)
  4. Vault Enforcement - No schema bypass in v1.0+
  5. 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

  1. Never manually edit vault files - Always use chameleon CLI
  2. Commit vault to version control - Track schema history alongside code
  3. Set mode password - Protect against unauthorized schema changes
  4. Review integrity.log regularly - Monitor for unexpected changes
  5. Use readonly mode in production - Prevent accidental modifications

Commands

Next Steps