Integrity Modes provide Unix-style protection rings for schema governance, enabling explicit control over who can modify schemas and when.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
ChameleonDB enforces schema changes through four integrity modes, each with different permission levels:| Mode | Ring | Use Case | Schema Changes | Password Required |
|---|---|---|---|---|
| readonly | R3 | Production (default) | ❌ Blocked | To upgrade |
| standard | R2 | Development teams | ✅ Controlled | To upgrade |
| privileged | R1 | DBAs | ✅ Direct (logged) | To upgrade |
| emergency | R0 | Incident recovery | ✅ No checks (audited) | To upgrade |
Mode upgrades (e.g.,
readonly → standard) require password authentication.Mode downgrades (e.g., standard → readonly) do NOT require password.Mode Descriptions
readonly (R3) — Production Default
Purpose: Lock schema changes in production environments. Behavior:- ❌ Migrations blocked
- ❌ Introspection blocked
- ✅ Queries allowed
- ✅ Reads from Schema Vault
standard (R2) — Development Teams
Purpose: Allow controlled schema changes for development workflows. Behavior:- ✅ Migrations allowed (with vault registration)
- ✅ Introspection allowed
- ✅ Full audit trail
- ✅ Integrity verification enforced
privileged (R1) — Database Administrators
Purpose: Direct database access with comprehensive logging. Behavior:- ✅ All standard operations
- ✅ Direct SQL execution (logged)
- ✅ Advanced recovery operations
emergency (R0) — Incident Recovery
Purpose: Critical incident recovery with minimal checks. Behavior:- ✅ All operations allowed
- ⚠️ Integrity checks skipped
- 📝 All actions heavily audited
Password Protection
Setting a Mode Password
Set a password to protect mode upgrades:Password Storage
Passwords are stored securely in:- Hashed using bcrypt
- Never stored in plaintext
- Protected by OS file permissions (0600)
Mode Management Workflow
Check Current Mode
View your current integrity mode:status for comprehensive info:
Upgrade Mode (Requires Password)
Upgrading to a higher ring requires password authentication:Downgrade Mode (No Password Required)
Downgrading to a lower ring does NOT require password:Downgrades are intentionally password-free to make it easy to lock down production environments.
Complete Examples
Development Workflow
Production Deployment
Authorized Schema Change in Production
Audit Trail
All mode changes are logged in the integrity log:Mode Enforcement
Operations Blocked in readonly Mode
| Operation | Command | Behavior |
|---|---|---|
| Migration | chameleon migrate --apply | ❌ Blocked |
| Introspection | chameleon introspect | ❌ Blocked |
| Validation | chameleon validate | ✅ Allowed |
| Status check | chameleon status | ✅ Allowed |
| Verify integrity | chameleon verify | ✅ Allowed |
Operations Allowed in standard Mode
| Operation | Command | Behavior |
|---|---|---|
| Migration | chameleon migrate --apply | ✅ Allowed (with vault registration) |
| Introspection | chameleon introspect | ✅ Allowed |
| All readonly ops | - | ✅ Allowed |
Common Workflows
Local Development
CI/CD Pipeline
Staging Environment
Security Best Practices
Set password immediately
Set password immediately
Configure a mode password right after initializing:
Use readonly in production
Use readonly in production
Always deploy production with readonly mode:
Minimize time in elevated modes
Minimize time in elevated modes
Upgrade, apply changes, then immediately downgrade:
Audit mode changes regularly
Audit mode changes regularly
Review integrity log for unauthorized access:
Secure password storage
Secure password storage
Never commit passwords to version control:
Use environment variables in CI/CD
Use environment variables in CI/CD
Pass passwords securely via encrypted secrets:
Common Issues
”mode password not set”
Solution: Set password first:“invalid password”
Solution: Re-enter correct password or reset:“readonly mode: blocked”
Solution: Upgrade mode with password:Forgot password
Solution: Reset password file (loses protection):Next Steps
Migration Workflow
Apply schema changes with proper modes
Introspection
Generate schemas (requires standard mode)
Security Model
Complete security architecture
Architecture
Understand the integrity system