Synopsis
Description
Themigrate command:
- Verifies Schema Vault integrity - Checks all version hashes
- Checks paranoid mode - Ensures schema changes are allowed
- Loads and merges schemas - Combines all
.chamfiles from configured paths - Detects changes - Compares merged schema with current vault version
- Generates migration SQL - Creates DDL statements
- Registers new version - Creates immutable snapshot in vault (if
--apply) - Applies migration - Executes SQL against database (if
--apply) - Updates state - Records migration in manifest and journal
Flags
boolean
default:"true"
Check for pending migrations without applying (default behavior)
boolean
default:"false"
Preview migration SQL without applying to databaseShows:
- Schema changes summary
- Generated SQL
- Does NOT register version or apply migration
boolean
default:"false"
Apply migration to database
- Registers new schema version in vault
- Executes migration SQL
- Updates state and journal
- Creates backup (if enabled in config)
Environment Variables
string
required
PostgreSQL connection string
string
Used as author name for schema versions. Defaults to “unknown” if not set.
Examples
Check for Pending Migrations
Preview Migration SQL
Apply Migration
Before Migration
Schema Files
schemas/users.cham:Vault State
After Migration
Modified Schema
schemas/users.cham:Run Migration
Updated Vault State
Paranoid Mode Behavior
Readonly Mode (Default)
Standard Mode
Integrity Verification
Integrity Check Passed
Integrity Violation Detected
Error Handling
Connection Failure
Schema Validation Error
Migration Execution Error
Migration Retry
If a migration fails, ChameleonDB tracks it:Configuration
Migration behavior is controlled by.chameleon.yml:
See Also
chameleon init- Initialize projectchameleon verify- Verify vault integritychameleon journal- View migration historychameleon status- Check current status- Schema Vault - Learn about versioning