Releases: ayarotsky/diesel-guard
v0.9.0
Release Notes
Added
AddCheckConstraintCheck- DetectsADD CHECKwithoutNOT VALID, which causes a full table scan (ACCESS EXCLUSIVE lock).AddForeignKeyCheck- DetectsADD FOREIGN KEYwithoutNOT VALID, which acquires a ShareRowExclusiveLock and blocks writes.warn_checksconfig option — Downgrade specific checks from errors to warnings. Violations still appear in output but do not cause a non-zero exit code. Mutually exclusive withdisable_checksandenable_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 path —
diesel-guard checknow defaults to./migrationswhen 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 | shInstall 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-guardDownload 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
Release Notes
Added
enable_checksconfig option — Whitelist specific checks to run exclusively. Setenable_checksindiesel-guard.tomlto run only the checks you care about. Cannot be combined withdisable_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 | shInstall 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-guardDownload 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
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
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-astCLI 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
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
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
What's Changed
- docs: Add "Path to v1" to README by @ayarotsky in #49
- ci(deps): Bump actions/cache from 4 to 5 by @dependabot[bot] in #51
- chore(deps): Bump camino from 1.2.1 to 1.2.2 in the patch-updates group by @dependabot[bot] in #50
- chore(deps): Bump the patch-updates group with 3 updates by @dependabot[bot] in #53
- feat: Add support for sqlx by @ayarotsky in #52
- chore: Bump version to 0.4.0 by @ayarotsky in #54
Full Changelog: v0.3.0...v0.4.0
v0.3.0
What's Changed
- Fix cargo docs warnings and add table of contents to README by @ayarotsky in #32
- Add AddUniqueConstraint check by @ayarotsky in #26
- Add ShortIntegerPrimaryKey check by @ayarotsky in #30
- Add DropIndex check by @ayarotsky in #36
- Fix CHECK constraint name in README by @tdelmas in #37
- ci: Lock rust toolchain to 1.90.0 by @ayarotsky in #39
- ci: Add Github Action by @ayarotsky in #41
- feat: Add TruncateTable check by @ayarotsky in #42
- feat: Add WideIndex check by @ayarotsky in #43
- feat: Add DropPrimaryKey check by @ayarotsky in #44
- Add spans and source code to parse errors by @Turbo87 in #40
- feat: Add AddPrimaryKey check by @ayarotsky in #45
- feat: Add AddJsonColumn check by @ayarotsky in #47
- chore: Bump version to 0.3.0 by @ayarotsky in #48
New Contributors
Full Changelog: v0.2.0...v0.3.0
v0.2.0
What's Changed
- Remove allow-unsafe config by @ayarotsky in #20
- ci(deps): Bump actions/checkout from 4 to 6 by @dependabot[bot] in #22
- ci(deps): Bump softprops/action-gh-release from 1 to 2 by @dependabot[bot] in #21
- chore: Refactoring after v0.1 release by @ayarotsky in #23
- Add CreateExtension check by @ayarotsky in #24
- Add UnnamedConstraint check by @ayarotsky in #25
- Add RenameColumn check by @ayarotsky in #27
- Add AddSerialColumn check by @ayarotsky in #29
- Add RenameTable check by @ayarotsky in #28
- Bump version to 0.2.0 by @ayarotsky in #31
Full Changelog: v0.1.1...v0.2.0
v0.1.1
What's Changed
- Allow different date formats for start_after by @ayarotsky in #18
- Bump version to 0.1.1 by @ayarotsky in #19
Full Changelog: v0.1.0...v0.1.1