Skip to main content
Integrity Modes provide Unix-style protection rings for schema governance, enabling explicit control over who can modify schemas and when.

Overview

ChameleonDB enforces schema changes through four integrity modes, each with different permission levels:
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
Use case: Production databases where schema changes should never happen without explicit authorization.

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
Use case: Development and staging environments where teams actively iterate on schemas.

privileged (R1) β€” Database Administrators

Purpose: Direct database access with comprehensive logging. Behavior:
  • βœ… All standard operations
  • βœ… Direct SQL execution (logged)
  • βœ… Advanced recovery operations
Use case: DBAs who need direct database access while maintaining audit compliance.
Privileged mode is planned for v1.1. In v1.0, use standard mode for DBA workflows.

emergency (R0) β€” Incident Recovery

Purpose: Critical incident recovery with minimal checks. Behavior:
  • βœ… All operations allowed
  • ⚠️ Integrity checks skipped
  • πŸ“ All actions heavily audited
Use case: Production outages requiring immediate schema fixes.
Emergency mode is planned for v1.1. In v1.0, use privileged mode with caution.

Password Protection

Setting a Mode Password

Set a password to protect mode upgrades:
Interactive prompt:
Set a mode password immediately after initializing your project to secure schema changes.

Password Storage

Passwords are stored securely in:
  • Hashed using bcrypt
  • Never stored in plaintext
  • Protected by OS file permissions (0600)
Add .chameleon/ to .gitignore to prevent committing passwords to version control.

Mode Management Workflow

Check Current Mode

View your current integrity mode:
Output:
Or use status for comprehensive info:
Output:

Upgrade Mode (Requires Password)

Upgrading to a higher ring requires password authentication:
1

Set Password (First Time Only)

2

Upgrade Mode

Interactive prompt:
3

Verify Mode Change

Output:

Downgrade Mode (No Password Required)

Downgrading to a lower ring does NOT require password:
Output:
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:
Example log entries:

Mode Enforcement

Operations Blocked in readonly Mode

Operations Allowed in standard Mode

Common Workflows

Local Development

CI/CD Pipeline

Staging Environment

Security Best Practices

Configure a mode password right after initializing:
Always deploy production with readonly mode:
Upgrade, apply changes, then immediately downgrade:
Review integrity log for unauthorized access:
Never commit passwords to version control:
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):
Deleting the password hash removes mode protection. Only do this if you have proper authorization.

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