Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PostgreSQL
  3. diesel-guard

diesel-guard

MITRustv0.11.0

Linter for dangerous Postgres migration patterns in Diesel and SQLx that prevents downtime from unsafe schema changes.

Visit WebsiteGitHubGitHub
114 stars10 forks0 contributors

What is diesel-guard?

Diesel Guard is a linter tool that analyzes PostgreSQL database migrations written for Diesel and SQLx frameworks to detect dangerous patterns that could cause production downtime. It identifies operations that lock tables, require full table rewrites, or otherwise disrupt database availability, providing safer alternatives before migrations reach production.

Target Audience

Rust developers using Diesel or SQLx for database operations, particularly teams managing PostgreSQL databases in production environments where migration safety is critical.

Value Proposition

Developers choose Diesel Guard because it catches potentially catastrophic database changes early in the development cycle using PostgreSQL's own parser for accurate analysis, without requiring a running database instance. Its version-aware checks and custom scripting capabilities make it adaptable to specific project needs.

Overview

Linter for dangerous Postgres migration patterns in Diesel and SQLx. Prevents downtime caused by unsafe schema changes.

Use Cases

Best For

  • Preventing production downtime from unsafe PostgreSQL schema changes
  • CI/CD pipelines that need to validate database migrations automatically
  • Teams using Diesel ORM who want to ensure migration safety
  • Projects using SQLx that require database operation validation
  • Catching table-locking operations before they reach production
  • Learning safer alternatives to common but dangerous migration patterns

Not Ideal For

  • Teams using databases other than PostgreSQL, such as MySQL or SQLite
  • Projects with migrations written for ORMs outside the Rust ecosystem, like ActiveRecord or Django
  • Applications where migrations are minimal and database downtime is not a critical concern

Pros & Cons

Pros

Accurate SQL Parsing

Uses PostgreSQL's own libpg_query parser, ensuring that detected issues match exactly what PostgreSQL will execute, reducing false positives as highlighted in the README.

Offline CI Integration

Works on SQL files without a running database instance, making it easy to embed in CI/CD pipelines for automated checks, as shown in the GitHub Actions example.

Version-Aware Checks

Configurable for specific PostgreSQL versions to suppress irrelevant warnings, such as constant defaults being safe on PG 11+, preventing false alarms.

Extensible Custom Rules

Supports Rhai scripting for adding project-specific validation rules, allowing teams to tailor checks to unique needs without forking the tool.

Cons

Limited Database Support

Exclusively targets PostgreSQL, so it cannot analyze migrations for other database systems like MySQL or SQLite, restricting its utility in polyglot environments.

Framework Dependency

Only compatible with Diesel and SQLx frameworks in Rust, making it irrelevant for projects using other ORMs or languages, despite its static analysis approach.

Configuration Overhead

Requires initial setup with `diesel-guard init` and understanding of TOML configuration, which adds complexity compared to drop-in linters with zero configuration.

Frequently Asked Questions

Quick Stats

Stars114
Forks10
Contributors0
Open Issues3
Last commit4 days ago
CreatedSince 2025

Tags

#migration#database#postgres#sqlx#linter#zero-downtime#diesel-orm#ci-cd#database-migrations#postgresql#cli#schema-changes#rust#diesel#static-analysis

Built With

R
Rhai
R
Rust

Links & Resources

Website

Included in

Rust56.6kStatic Analysis & Code Quality14.5kPostgreSQL11.8k
Auto-fetched 23 hours ago

Related Projects

trivytrivy

Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more

Stars35,255
Forks404
Last commit2 days ago
SurrealDBSurrealDB

A scalable, distributed, collaborative, document-graph database, for the realtime web

Stars32,281
Forks1,272
Last commit3 days ago
Hasura GraphQL EngineHasura GraphQL Engine

Blazing fast, instant realtime GraphQL APIs on all your data with fine grained access control, also trigger webhooks on database events.

Stars31,974
Forks2,878
Last commit3 days ago
QdrantQdrant

Qdrant - High-performance, massive-scale Vector Database and Vector Search Engine for the next generation of AI. Also available in the cloud https://cloud.qdrant.io/

Stars31,686
Forks2,304
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub