Skip to content

Releases

v0.1.4

Choose a tag to compare

@tbson tbson released this 17 Nov 16:57

Added

  • Views in the migration history are read. CREATE VIEW, CREATE OR REPLACE VIEW and CREATE MATERIALIZED VIEW used to be listed as not read. They now become part of the schema the change runs against, with the tables and columns each view's query reads (* reads every column), and they follow DROP VIEW and table and column renames. A change a view stands in the way of is reported under Dependent objects:

    Dependent objects
      0002.sql:1  1 object depends on customers.email, and the database refuses the change
          view customer_emails depends on customers.email. The database refuses the change while it exists.
    

    Views are read from --before and from a --schema dump. A view created by hand outside the migrations is not in the files, so it is not known here.

  • A DELETE reports what it cascades to. A DELETE from a table that foreign keys reference ON DELETE CASCADE now lists every table it also deletes from, at any depth, under Spreads:

      0002.sql:2  Deleting from customers also deletes from 2 entities through ON DELETE CASCADE
          orders (via fk_orders_customer_id, 1 hop)
          order_items (via fk_order_items_order_id, 2 hops)
    

    fail-on: spreads fails the job on it. SET NULL and SET DEFAULT children are not listed yet.

Fixed

  • A type change no longer warns about a MySQL, MariaDB or SQL Server view. A view held by name reads the retyped column and keeps working (measured on MySQL 8.4, MariaDB 11.4 and SQL Server 2022), so it is no longer reported as failing the next time it runs. PostgreSQL still refuses the change, and that is still reported.

Upgrade

Nothing to change in a workflow that uses schemity/ci@v1 with the default version: latest. A workflow pinned to an earlier version needs version: v0.1.4.

Downloads

File For
schemity-x86_64-unknown-linux-musl.tar.gz Linux x64
schemity-aarch64-unknown-linux-musl.tar.gz Linux ARM64
schemity-aarch64-apple-darwin.tar.gz macOS on Apple silicon

Each archive holds the schemity binary, its license and the licenses of the open source software in it. SHA-256 sums are in checksums.txt.

v0.1.3

Choose a tag to compare

@tbson tbson released this 17 Nov 15:38

A release of the schemity command line tool and the Schemity Migration Check action.

Fixed

  • goose and dbmate migrations are read for their up half only. Both keep the up and down directions in one file, and the down half was replayed too, so a DROP TABLE under -- +goose Down removed the table its up half had just created. Only what runs on the way forward (-- +goose Up, -- migrate:up) is read now, and line numbers still point into the file.
  • Down files are skipped. A folder passed as --before no longer replays golang-migrate and sqlx .down.sql, Diesel's down.sql or a Flyway U undo. The action leaves them out of the pull request's files too, so fail-on: loses-data no longer fails every pull request that adds a down file.

Changed

  • A design finding shows on the line that introduces it. With --format github, a lint finding is placed on the first changed statement that names its table and column, so the fk-no-covering-index finding for ALTER TABLE orders ADD COLUMN referrer_id bigint REFERENCES customers (id); appears under that line in Files changed, not only on the run's summary. The JSON report gains file and line on each lint finding.
  • The header counts in the singular: Schema before: 1 table from 1 file.

Upgrade

Nothing to change in a workflow that uses schemity/ci@v1 with the default version: latest. A workflow pinned to an earlier version needs version: v0.1.3.

Downloads

File For
schemity-x86_64-unknown-linux-musl.tar.gz Linux x64
schemity-aarch64-unknown-linux-musl.tar.gz Linux ARM64
schemity-aarch64-apple-darwin.tar.gz macOS on Apple silicon

Each archive holds the schemity binary, its license and the licenses of the open source software in it. SHA-256 sums ar

v0.1.2

Choose a tag to compare

@tbson tbson released this 17 Nov 10:42

A release of the schemity command line tool and the Schemity Migration Check action.

Added

  • A MySQL migration that declares a foreign key inline is reported. MySQL 8.4 accepts a column's own REFERENCES without a warning and creates no key; MySQL 9.7 and MariaDB create it:

    ALTER TABLE posts ADD COLUMN author_id INT REFERENCES users (id);

    It now appears under Storage engine, for CREATE TABLE and ADD COLUMN: "Declares the foreign key on posts.author_id inline, which MySQL 8.4 accepts without creating a key; 9.7 creates it, and a FOREIGN KEY constraint works on both". Write the key as CONSTRAINT ... FOREIGN KEY (...) REFERENCES ... to have it on every version. fail-on: storage-engine fails the job on it. MySQL only.

Upgrade

Nothing to change in a workflow that uses schemity/ci@v1 with the default version: latest. A workflow pinned to an earlier version needs version: v0.1.2.

Downloads

File For
schemity-x86_64-unknown-linux-musl.tar.gz Linux x64
schemity-aarch64-unknown-linux-musl.tar.gz Linux ARM64
schemity-aarch64-apple-darwin.tar.gz macOS on Apple silicon

Each archive holds the schemity binary, its license and the licenses of the open source software in it. SHA-256 sums are in checksums.txt.

v0.1.1

Choose a tag to compare

@tbson tbson released this 17 Nov 10:12

A bug-fix release of the schemity command line tool and the Schemity Migration Check action.

Fixed

  • A foreign key declared inline on an added column is no longer lost. When an older migration added a column with its key in the same clause, the rebuilt schema had the column but not the key:

    ALTER TABLE orders ADD COLUMN coupon_id bigint REFERENCES customers (id);

    As a result, every finding that depends on that key was missing, for example fk-no-covering-index on orders.coupon_id. The key is now kept with its name, ON DELETE and ON UPDATE, as it is for ADD CONSTRAINT ... FOREIGN KEY and for a key declared inside CREATE TABLE. Fixed for every supported database.

Upgrade

Nothing to change in a workflow that uses schemity/ci@v1 with the default version: latest: the next run downloads 0.1.1. A workflow pinned to version: v0.1.0 needs version: v0.1.1.

Downloads

File For
schemity-x86_64-unknown-linux-musl.tar.gz Linux x64
schemity-aarch64-unknown-linux-musl.tar.gz Linux ARM64
schemity-aarch64-apple-darwin.tar.gz macOS on Apple silicon

Each archive holds the schemity binary, its license and the licenses of the open source software in it. SHA-256 sums are in checksums.txt.

v0.1.0

Choose a tag to compare

@tbson tbson released this 17 Nov 08:59

First release of the schemity command line tool and the Schemity Migration Check action.

It reports what SQL migration files do, before they run, with no database and no credentials:

  • What each statement does to existing data: drops it, can fail on it, rewrites the table, holds back other statements, and which other tables it reaches through foreign keys.
  • Design findings the change introduces: 46 rules, such as a foreign key with no index or a table with no primary key. schemity rules --dialect <name> lists them.

The schema a migration runs against is rebuilt from the older migration files in the repo, or from a schema dump (pg_dump --schema-only, structure.sql). Nothing is executed and nothing is sent anywhere.

Use in a workflow

- uses: actions/checkout@v6
- uses: schemity/ci@v1
  with:
    dialect: postgres
    migrations: db/migrations

The job passes whatever the report says, unless fail-on is set (for example fail-on: loses-data,can-fail).

Databases

PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, Snowflake, CockroachDB.

Downloads

File For
schemity-x86_64-unknown-linux-musl.tar.gz Linux x64
schemity-aarch64-unknown-linux-musl.tar.gz Linux ARM64
schemity-aarch64-apple-darwin.tar.gz macOS on Apple silicon

Each archive holds the schemity binary, its license and the licenses of the open source software in it. SHA-256 sums are in checksums.txt.

Not in this release

  • Windows and Intel macOS builds.
  • Finding where a schema dump ends: with schema, name the newer migrations in before.
  • Row counts and views: there is no database to ask. The Schemity desktop app reports those against a live connection.