dblift validate
Validate migration scripts. Compares every applied entry in the schema history table against the script that produced it and fails if the two have diverged. Checksums are the default check. Missing applied files need `--strict`.
Synopsis
$ dblift validate [--target-version VERSION]
[--tags TAGS] [--exclude-tags TAGS]
[--versions LIST] [--exclude-versions LIST]
[--placeholders K=V [K=V ...]]
[--strict] [--table TABLE]Options
--tableCustom schema history table name (default: dblift_schema_history)--strictEnable strict mode - fail if any previously applied migration is missing and require migrations to be applied in strict version order--tagsExecute migrations with specified tags (comma-separated list)--exclude-tagsSkip migrations with specified tags (comma-separated list)--versionsExecute only specific versions (comma-separated list)--exclude-versionsSkip specific versions (comma-separated list)--placeholdersSQL placeholders for variable substitution in migration scripts. Format: key1=value1,key2=value2 or key1=value1 key2=value2. Can be repeated: --placeholders k1=v1 --placeholders k2=v2--db-urlDatabase URL--db-usernameDatabase username--db-passwordDatabase password--db-schemaDatabase schema--target-versionValidate migrations up to this version--formatOutput format (default: console)What validate checks
Without `--strict`, validate checks the scripts on disk (duplicate versions, unsupported formats) and, once history has applied rows, checksums against those rows. `--strict` also fails when a previously applied migration is missing from disk and requires strict version order. That missing-file check needs a schema-history table that already has applied rows. `--format json` sets `error` to null on success, not an empty string. A permission failure shows the database's own message. If the history table cannot be created — a reader role on an empty schema — the CLI errors with `ConnectionError` and JSON is `{"success": false, "error": "ConnectionError: ..."}`, not a validation verdict. `DBLiftClient.validate()` returns a failed result for that failure and for a connection that cannot be opened; it does not raise. The MCP `validate` tool takes `strict` (default false) and reports the same CLI error as an MCP error result. A checksum verdict stays a normal result with `success: false`.
Global flags apply to every command: --config, --env, --scripts, --dry-run, --quiet, --log-level. See global flags.
Examples
Compare applied history to the scripts on disk
$ dblift validate┏━━━━━━━━━━━━━━━━━━━━━━━ DBLIFT DATABASE MIGRATION LOG ━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Timestamp: 2026-01-15 12:00:00 ┃ ┃ Dblift version: 3.9.0 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ DBLIFT COMMAND: VALIDATE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Connected to database ./app.db (SQLite) ┃ ┃ Database: ./app.db ┃ ┃ Schema: main ┃ ┃ Schema Version: 1.0.0 ┃ ┃ Database URL: sqlite:///./app.db ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ Found 1 callback migrations. Migration validation passed ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SUCCESS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Command VALIDATE completed successfully (Execution time: 12 ms) ┃ ┃ Schema Version: 1.0.0 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Also refuse out-of-order pending files and missing applied scripts
$ dblift validate --strictStrict mode is enabled. All migrations will be validated against strict rules. ┏━━━━━━━━━━━━━━━━━━━━━━━ DBLIFT DATABASE MIGRATION LOG ━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Timestamp: 2026-01-15 12:00:00 ┃ ┃ Dblift version: 3.9.0 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ DBLIFT COMMAND: VALIDATE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Connected to database ./app.db (SQLite) ┃ ┃ Database: ./app.db ┃ ┃ Schema: main ┃ ┃ Schema Version: 1.2.0 ┃ ┃ Database URL: sqlite:///./app.db ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ Found 1 callback migrations. Strict mode is enabled. Validating with strict migration rules. Migration validation passed ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SUCCESS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Command VALIDATE completed successfully (Execution time: 12 ms) ┃ ┃ Schema Version: 1.2.0 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Validate only up to a ceiling version
$ dblift validate --target-version 1.1.0┏━━━━━━━━━━━━━━━━━━━━━━━ DBLIFT DATABASE MIGRATION LOG ━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Timestamp: 2026-01-15 12:00:00 ┃ ┃ Dblift version: 3.9.0 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ DBLIFT COMMAND: VALIDATE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Connected to database ./app.db (SQLite) ┃ ┃ Database: ./app.db ┃ ┃ Schema: main ┃ ┃ Schema Version: 1.2.0 ┃ ┃ Database URL: sqlite:///./app.db ┃ ┃ Filtering Options: --target-version=1.1.0 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ Found 1 callback migrations. Migration validation passed ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SUCCESS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Command VALIDATE completed successfully (Execution time: 12 ms) ┃ ┃ Schema Version: 1.2.0 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Exit codes
0Command completed successfully4A paid-edition feature was invoked without a valid licence (EXIT_LICENSE_REQUIRED)