Skeema v1.2.0 released

March 12, 2019

Skeema v1.2.0 has been released, including two major new features: support for stored procedures and functions, and improved linter functionality.

Stored procedures and functions

Up until this point, Skeema’s primary focus has been tables, as these are the primary object in a relational database. However, Skeema’s declarative model can be applied to other types of database objects as well. This release adds support for managing routines (stored procedures and functions) with Skeema, providing the first step towards eventually managing all available database object types with a single tool.

This functionality affects Skeema commands as follows:

  • skeema init and skeema pull will write out procs/funcs to .sql files
  • skeema diff and skeema push will compare procs/funcs in .sql files to those in the target db
  • skeema lint will sanity-check procs/funcs in .sql files

A new diff/push option, compare-metadata, has also been added. This controls whether or not Skeema considers creation-time db_collation and sql_mode when comparing procs/funcs.

If your database is using stored procedures and/or functions, running skeema pull once after upgrading to v1.2.0 is recommended. This will create a filesystem representation of all of your existing stored procedures and functions, so that you can track them in your repo.

Please see the requirements documentation for important notes about edge cases for routines.

Improved linter functionality

Historically, skeema lint focused on confirming that all SQL CREATE statements were valid, and reformatting statements to match their canonical form shown by SHOW CREATE. In the future, however, skeema lint will become a full-fledged configurable MySQL/MariaDB schema linter. This release begins this transition by introducing the notion of named “problems” that the linter can detect, and adding several new options to control the linter’s behavior.

Skeema v1.2.0 includes four new options affecting skeema lint:

  • errors: list of named problems (see below) to trigger a fatal error
  • warnings: list of named problems to trigger a non-fatal warning message
  • allow-charset: list of character sets to permit without triggering bad-charset problem
  • allow-engine: list of storage engines to permit without triggering bad-engine problem

Three simple named problem detectors are included so far:

  • no-pk: triggered for tables that have no PRIMARY KEY definition
  • bad-charset: triggered for tables using disallowed character sets
  • bad-engine: triggered for tables using disallowed storage engines

Future releases will add additional problem detectors, such as the ability to identify redundant indexes, or prohibit the use of particular database features.

A matching CI-like “auto-linter” will soon be entering beta testing. Learn more and sign up for the beta at the blog post.

This release does not yet automatically run the linter prior to diff/push, but that is planned for the near future. Finally, it is likely that the reformatting logic of skeema lint will be made optional, and a separate skeema format command may be introduced to match the old behavior of skeema lint.