Schema DDL

Query SELECT / INSERT / UPDATE / DELETE

Diagnostics

    Use it in your project

    The same checks run from the command line, in CI, and in your editor. Point sqlsift at your schema (migrations, schema.sql, a pg_dump…) and the queries you want to validate.

    Run it once

    No install needed with npx.

    npx sqlsift-cli check --schema schema.sql query.sql

    Install

    From npm, or from source with Cargo. In an existing project, sqlsift init finds the schema and queries and writes a sqlsift.toml.

    npm install -g sqlsift-cli
    # or
    cargo install --git https://github.com/yukikotani231/sqlsift sqlsift-cli
    
    sqlsift init
    sqlsift check

    GitHub Actions

    Fail pull requests that reference columns that do not exist, with annotations on the diff. diff-base reports only what the pull request introduces.

    # .github/workflows/sqlsift.yml
    name: SQL Lint
    on: [push, pull_request]
    jobs:
      sqlsift:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: yukikotani231/sqlsift@main
            with:
              schema-dir: db/migrations
              files: queries/**/*.sql
              diff-base: ${{ github.base_ref }}

    Configure defaults with a sqlsift.toml, silence a line with -- sqlsift:disable E0002, or get live diagnostics in VS Code. See the user guide and the example projects for sqlc, Prisma, postgres.js, sqlx, MySQL and dbt.