Docs: Commands: push

Usage: skeema push [<options>] [<environment>]

Modifies the schemas on database instance(s) to match the corresponding filesystem representation of them. This essentially performs the same diff logic as skeema diff, but then actually runs the generated DDL. You should generally run skeema diff first to see what changes will be applied.

You may optionally pass an environment name as a CLI arg. This will affect which section of .skeema config files is used for processing. For example, running skeema push 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”.

An exit code of 0 will be returned if the operation was fully successful; 1 if at least one table could not be updated due to use of unsupported features, or if the dry-run option was used and differences were found; or 2+ if a fatal error occurred.

External Tool Options

OptionDescription
alter-wrapperExternal bin to shell out to for ALTER TABLE; see manual for template vars
alter-wrapper-min-sizeIgnore alter-wrapper for tables smaller than this size in bytes
ddl-wrapperLike alter-wrapper, but applies to all DDL types (CREATE, DROP, ALTER)

SQL Generation Options

OptionDescription
alter-algorithmApply an ALGORITHM clause to all ALTER TABLEs
alter-lockApply a LOCK clause to all ALTER TABLEs
alter-validate-virtualApply a WITH VALIDATION clause to ALTER TABLEs affecting virtual columns
compare-metadataFor stored programs, detect changes to creation-time sql_mode or DB collation
exact-matchFollow *.sql table definitions exactly, even for differences with no functional impact
insertsDetermine whether to process INSERT statements found in the *.sql files
lax-column-orderWhen comparing tables, don’t re-order columns if they only differ by position
lax-commentsWhen comparing tables or routines, don’t modify them if they only differ by comment clauses
partitioningSpecify handling of partitioning status on the database side
strip-definerIgnore DEFINER clauses when comparing procs, funcs, views, or triggers

Linter Rule Options

OptionDescription
allow-auto-incList of allowed auto_increment column data types for lint-auto-inc
allow-charsetList of allowed character sets for lint-charset
allow-compressionList of allowed compression settings for lint-compression
allow-definerList of allowed routine definers for lint-definer
allow-engineList of allowed storage engines for lint-engine
allow-pk-typeList of allowed data types for lint-pk-type
lintCheck modified objects for problems before proceeding (enabled by default; disable with skip-lint)
lint-auto-incOnly allow auto_increment column data types listed in allow-auto-inc
lint-charsetOnly allow character sets listed in allow-charset
lint-compressionOnly allow compression settings listed in allow-compression
lint-definerOnly allow routine definers listed in allow-definer
lint-display-widthOnly allow default display width for int types
lint-dupe-indexFlag redundant secondary indexes
lint-engineOnly allow storage engines listed in allow-engine
lint-has-enumFlag columns using ENUM or SET data types
lint-has-fkFlag any use of foreign keys; intended for environments that restrict their presence
lint-has-floatFlag columns using FLOAT or DOUBLE data types
lint-has-routineFlag any use of stored procs or funcs; intended for environments that restrict their presence
lint-has-timeFlag columns using TIMESTAMP, DATETIME, or TIME data types
lint-has-triggerFlag any use of triggers; intended for environments that restrict their presence
lint-has-viewFlag any use of views; intended for environments that restrict their presence
lint-name-caseFlag tables or views that have uppercase letters in their names
lint-pkFlag tables that lack a primary key
lint-pk-typeOnly allow primary keys to have types listed in allow-pk-type
lint-reserved-wordFlag names of tables, columns, routines, views, or triggers which match reserved words
lint-zero-dateFlag DATE, DATETIME, and TIMESTAMP columns that have zero-date default values

Safety Options

OptionDescription
allow-unsafePermit running ALTER or DROP operations that are potentially destructive
dry-runOutput DDL but don’t run it; equivalent to skeema diff
foreign-key-checksForce the server to check referential integrity of any new foreign key
safe-below-sizeAlways permit destructive operations for tables below this size in bytes
verifyTest all generated ALTER statements on temp schema to verify correctness (enabled by default; disable with skip-verify)

Sharding Options

OptionDescription
concurrent-instancesPerform operations on this number of instances concurrently
first-onlyFor dirs mapping to multiple instances or schemas, just run against the first per dir

Workspace Options

OptionDescription
docker-cleanupWith workspace=docker, specifies how to clean up containers
temp-schemaName of temporary schema for intermediate operations, created and dropped each run
temp-schema-binlogControls whether temp schema DDL operations are replicated
temp-schema-environmentOffload the temp schema to a different host, as configured by the specified environment
temp-schema-threadsMax number of concurrent CREATE/DROP with workspace=temp-schema
workspaceSpecifies where to run intermediate operations

Global Options

OptionDescription
connect-optionsComma-separated session options to set upon connecting to each database instance
debugEnable debug logging
helpDisplay usage information for the specified command
host-wrapperExternal bin to shell out to for host lookup; see manual for template vars
ignore-funcIgnore functions that match regex
ignore-procIgnore stored procedures that match regex
ignore-schemaIgnore schemas that match regex
ignore-tableIgnore tables or views that match regex
ignore-triggerIgnore triggers that match regex
ignore-viewIgnore views that match regex
my-cnfParse ~/.my.cnf for configuration (enabled by default; disable with skip-my-cnf)
passwordPassword for database user; omit value to prompt from TTY
server-public-key-pathFile path to server public key in PEM format; omit to obtain from server
sshTunnel MySQL connections thru SSH to this hostname or user@hostname:port
ssh-to-dbSSH to database host in order to establish database connections locally
ssl-caFile path to certificate authority in PEM format
ssl-certFile path to client-side public key in PEM format
ssl-keyFile path to client-side private key in PEM format
ssl-modeSpecify desired connection security SSL/TLS usage
ssl-verify-server-certVerify server-side cert matches server hostname
userUsername to connect to database host
versionDisplay program version