Usage: skeema diff [<options>] [<environment>]
Compares the schemas on database server(s) to the corresponding filesystem representation of them. The output is a series of DDL commands that, if run on the DB server, would cause its schemas to now match the definitions from the filesystem.
You may optionally pass an environment name as a command-line arg. This will affect which section of .skeema config files is used for processing. For example, running skeema diff staging
will apply config directives from the [staging] section of config files, as well as any sectionless directives at the top of the file. If no environment name is supplied, the default is “production”.
The skeema diff
command is equivalent to running skeema push
with its dry-run option enabled.
An exit code of 0 will be returned if no differences were found; 1 if some differences were found; or 2+ if an error occurred.
SQL Generation Options
Option | Description |
---|
alter-algorithm | Apply an ALGORITHM clause to all ALTER TABLEs |
alter-lock | Apply a LOCK clause to all ALTER TABLEs |
alter-validate-virtual | Apply a WITH VALIDATION clause to ALTER TABLEs affecting virtual columns |
compare-metadata | For stored programs, detect changes to creation-time sql_mode or DB collation |
exact-match | Follow *.sql table definitions exactly, even for differences with no functional impact |
inserts | Determine whether to process INSERT statements found in the *.sql files |
lax-column-order | When comparing tables, don’t re-order columns if they only differ by position |
lax-comments | When comparing tables, routines, or events, don’t modify them if they only differ by COMMENT clauses |
partitioning | Specify handling of partitioning status on the database side |
strip-definer | Ignore DEFINER clauses when comparing stored objects |
Linter Rule Options
Safety Options
Option | Description |
---|
allow-unsafe | Permit generating ALTER or DROP operations that are potentially destructive |
safe-below-size | Always permit generating destructive operations for tables below this size in bytes |
verify | Test all generated ALTER statements on temp schema to verify correctness (enabled by default; disable with skip-verify) |
Sharding Options
Option | Description |
---|
brief | Don’t output DDL to STDOUT; instead output list of database servers with at least one difference |
concurrent-instances | Perform operations on this number of database servers concurrently |
first-only | For dirs mapping to multiple hosts or schemas, only run against the first target per dir |
Workspace Options
Global Options
Option | Description |
---|
connect-options | Comma-separated session options to set upon connecting to each database server |
debug | Enable debug logging |
help | Display usage information for the specified command |
host-wrapper | External bin to shell out to for host lookup; see manual for template vars |
ignore-event | Ignore events that match regex |
ignore-func | Ignore functions that match regex |
ignore-proc | Ignore stored procedures that match regex |
ignore-schema | Ignore schemas that match regex |
ignore-table | Ignore tables or views that match regex |
ignore-trigger | Ignore triggers that match regex |
ignore-view | Ignore views that match regex |
my-cnf | Parse ~/.my.cnf for configuration (enabled by default; disable with skip-my-cnf) |
password | Password for database user; omit value to prompt from TTY |
server-public-key-path | File path to server public key in PEM format; omit to obtain from server |
ssh | Tunnel MySQL connections thru SSH to this hostname or user@hostname:port |
ssh-to-db | SSH to database host in order to establish database connections locally |
ssl-ca | File path to certificate authority in PEM format |
ssl-cert | File path to client-side public key in PEM format |
ssl-key | File path to client-side private key in PEM format |
ssl-mode | Specify desired connection security SSL/TLS usage |
ssl-verify-server-cert | Verify server-side cert matches server hostname |
user | Username to connect to database host |
version | Display program version |