Skip to content

Releases: ayarotsky/diesel-guard

v0.9.0

22 Mar 02:51

Choose a tag to compare

Release Notes

Added

  • AddCheckConstraintCheck - Detects ADD CHECK without NOT VALID, which causes a full table scan (ACCESS EXCLUSIVE lock).
  • AddForeignKeyCheck - Detects ADD FOREIGN KEY without NOT VALID, which acquires a ShareRowExclusiveLock and blocks writes.
  • warn_checks config option — Downgrade specific checks from errors to warnings. Violations still appear in output but do not cause a non-zero exit code. Mutually exclusive with disable_checks and enable_checks.
  • Pre-commit hook support — diesel-guard can now be used as a pre-commit hook.
  • Migration metadata parsing — Diesel and SQLx migration metadata (-- no-transaction) is now parsed and exposed to checks as context. Context-aware checks (AddIndexCheck, DropIndexCheck, ReindexCheck) use this to permit CONCURRENTLY outside transactions.

Changed

  • Default check pathdiesel-guard check now defaults to ./migrations when no path is given.
  • Improved parse error messages — SQL parse failures now show the offending SQL with a highlighted span.
  • Improved CONCURRENTLY hint messages — Hints for operations requiring CONCURRENTLY are now clearer about when and why to use it.

Install diesel-guard 0.9.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ayarotsky/diesel-guard/releases/download/v0.9.0/diesel-guard-installer.sh | sh

Install prebuilt binaries via powershell script

powershell -ExecutionPolicy Bypass -c "irm https://github.com/ayarotsky/diesel-guard/releases/download/v0.9.0/diesel-guard-installer.ps1 | iex"

Install prebuilt binaries via Homebrew

brew install ayarotsky/tap/diesel-guard

Download diesel-guard 0.9.0

File Platform Checksum
diesel-guard-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
diesel-guard-x86_64-apple-darwin.tar.xz Intel macOS checksum
diesel-guard-x86_64-pc-windows-msvc.zip x64 Windows checksum
diesel-guard-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
diesel-guard-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.8.0

07 Mar 01:34

Choose a tag to compare

Release Notes

Added

  • enable_checks config option — Whitelist specific checks to run exclusively. Set enable_checks in diesel-guard.toml to run only the checks you care about. Cannot be combined with disable_checks.
  • Stdin input — Pipe SQL directly into diesel-guard with diesel-guard check -. Useful for editor integrations and shell pipelines.

Changed

  • Prebuilt binaries — Releases now ship prebuilt binaries for all supported platforms (Linux x86_64/ARM64, macOS x86_64/ARM64, Windows x86_64) via GitHub Releases, Homebrew tap (brew install ayarotsky/tap/diesel-guard), and shell/PowerShell installers. No Rust toolchain required.

Install diesel-guard 0.8.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ayarotsky/diesel-guard/releases/download/v0.8.0/diesel-guard-installer.sh | sh

Install prebuilt binaries via powershell script

powershell -ExecutionPolicy Bypass -c "irm https://github.com/ayarotsky/diesel-guard/releases/download/v0.8.0/diesel-guard-installer.ps1 | iex"

Install prebuilt binaries via Homebrew

brew install ayarotsky/tap/diesel-guard

Download diesel-guard 0.8.0

File Platform Checksum
diesel-guard-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
diesel-guard-x86_64-apple-darwin.tar.xz Intel macOS checksum
diesel-guard-x86_64-pc-windows-msvc.zip x64 Windows checksum
diesel-guard-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
diesel-guard-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.7.0

24 Feb 02:09

Choose a tag to compare

Added

postgres_version config option — Set postgres_version in diesel-guard.toml to your target PostgreSQL major version. Checks that are safe from that version onward are skipped automatically. On PostgreSQL 11+, AddColumnCheck no longer flags constant defaults (boolean, integer, string literal, or NULL) since they are metadata-only changes. Custom Rhai scripts receive the config as a config variable and can branch on config.postgres_version.

v0.6.0

17 Feb 02:17

Choose a tag to compare

What's Changed

  • Custom checks via Rhai scripting — Enforce team-specific migration conventions beyond the built-in checks. Scripts operate on the full pg_query AST, so any pattern expressible in SQL is detectable. They integrate with existing features: can be disabled via disable_checks, skipped inside safety-assured blocks, and included in both human-readable and JSON output.
  • dump-ast CLI subcommand — Print the pg_query AST for a SQL statement as JSON (diesel-guard dump-ast --sql "...")
  • 6 example Rhai scripts: no_unlogged_tables, require_concurrent_index, require_if_exists_on_drop, require_index_name_prefix, limit_columns_per_index, no_truncate_in_production

Full Changelog: v0.5.1...v0.6.0

v0.5.1

11 Feb 22:21

Choose a tag to compare

What's Changed

  • chore(deps): Bump clap from 4.5.54 to 4.5.56 in the patch-updates group by @dependabot[bot] in #68
  • chore(deps): Bump the patch-updates group with 2 updates by @dependabot[bot] in #70
  • Do not ignore check_down when checking a specific migration by @ayarotsky in #72
  • Bump version to 0.5.1 by @ayarotsky in #73

Full Changelog: v0.5.0...v0.5.1

v0.5.0

20 Jan 04:52

Choose a tag to compare

New Safety Checks

This release adds 6 new migration checks to help you write safer Postgres migrations:

1. Reindex
Detects REINDEX operations that acquire ACCESS EXCLUSIVE locks. These locks block all reads and writes on the table, which can cause downtime in production environments.

2. Generated Column
Detects GENERATED ALWAYS AS ... STORED columns. Adding stored generated columns triggers a full table rewrite, which can be slow and lock-intensive on large tables.

3. Timestamp
Detects TIMESTAMP columns without time zone specification. Recommends using TIMESTAMPTZ instead, which stores timestamps in UTC and handles time zones correctly—avoiding subtle timezone-related bugs.

4. Char Type

Detects CHAR or CHARACTER column types. These fixed-width types waste space and can cause unexpected padding behavior. Recommends TEXT or VARCHAR as better alternatives.

5. Drop Database

Detects DROP DATABASE operations. These are destructive and irreversible. The check ensures you're aware when a migration contains such operations.

6. Drop Table

Detects DROP TABLE operations. Similar to above, this catches potentially destructive operations before they reach production.

What's Changed

  • chore(deps): Bump tempfile from 3.23.0 to 3.24.0 by @dependabot[bot] in #56
  • chore(deps): Bump serde_json from 1.0.146 to 1.0.148 in the patch-updates group by @dependabot[bot] in #55
  • chore(deps): Bump clap from 4.5.53 to 4.5.54 in the patch-updates group by @dependabot[bot] in #57
  • chore(deps): Bump the patch-updates group with 2 updates by @dependabot[bot] in #58
  • Add DropTable check by @ayarotsky in #59
  • feat: Add DropDatabase check by @ayarotsky in #60
  • feat: Add CharType check by @ayarotsky in #61
  • chore(deps): Bump colored from 3.0.0 to 3.1.1 by @dependabot[bot] in #63
  • chore(deps): Bump thiserror from 2.0.17 to 2.0.18 in the patch-updates group by @dependabot[bot] in #62
  • feat: Add TimestampType check by @ayarotsky in #64
  • feat: Add GeneratedColumn check by @ayarotsky in #65
  • feat: Add Reindex check by @ayarotsky in #66
  • chore: Bump version to 0.5.0 by @ayarotsky in #67

Full Changelog: v0.4.0...v0.5.0

v0.4.0

29 Dec 04:53

Choose a tag to compare

What's Changed

Full Changelog: v0.3.0...v0.4.0

v0.3.0

14 Dec 00:05

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.0...v0.3.0

v0.2.0

08 Dec 04:42

Choose a tag to compare

What's Changed

Full Changelog: v0.1.1...v0.2.0

v0.1.1

06 Dec 04:54

Choose a tag to compare

What's Changed

Full Changelog: v0.1.0...v0.1.1