Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

database_consistency

> 后端框架
Open source

The tool to avoid various issues due to inconsistencies and inefficiencies between a database schema and application models.

1.2K stars0 likes5 views
WebsiteGitHub

About

The tool to avoid various issues due to inconsistencies and inefficiencies between a database schema and application models.

DatabaseConsistency

The main goal of the project is to help you avoid various issues due to inconsistencies and inefficiencies between a database schema and application models.

If the project helps you or your organization, I would be very grateful if you contribute or donate.
Your support is an incredible motivation and the biggest reward for my hard work.

The project is greatly supported by Pennylane! Huge appreciation to the organization, and please join them if you find the gem valuable for you!

For detailed information, please read the wiki.

Currently, the tool can:

  • find missing null constraints
  • find missing check constraints for numericality validations
  • find missing length validations
  • find missing presence validations
  • find missing uniqueness validations
  • find missing foreign keys for BelongsTo associations
  • find missing unique indexes for uniqueness validation
  • find missing indexes for HasOne and HasMany associations
  • find primary keys with integer/serial type
  • find mismatching primary key types with their foreign keys
  • find redundant non-unique indexes
  • find redundant uniqueness constraints
  • find mismatching enum types with their values
  • find mismatching foreign key cascades
  • find inconsistent values between enums in the database and ActiveRecord's enums/inclusion validations
  • find redundant case_sensitive: false option for unique validations for case-insensitive types
  • find missing null constraints on boolean fields
  • find broken associations that refer to non-existent models
  • find models that have missing tables
  • find models with UUID primary keys without specified ordering column
  • find belongs_to associations with foreign keys without dependent/on_delete options
  • find polymorphic associations with mismatched foreign key and type null constraints
  • find columns used in find_by calls that are missing a database index
  • find models pointing to views without a primary_key set

Besides that, the tool provides:

  • auto-correction
  • flexible configuration
  • slow start with TODO files
  • support of custom checker

We support the following databases: SQLite3, PostgreSQL and MySQL.
We support ActiveRecord only at the moment. Please upvote the request for other frameworks if you're interested.

Follow me and stay tuned for the updates:

  • LinkedIn
  • Medium
  • Twitter
  • GitHub

Usage

Add this line to your application's Gemfile:

ruby
gem 'database_consistency', group: :development, require: false

And then execute:

bash
$ bundle install

Example

…

Funding

Open Collective Backers

You're an individual who wants to support the project with a monthly donation. Your logo will be available on the Github page. [Become a backer]

Open Collective Sponsors

You're an organization that wants to support the project with a monthly donation. Your logo will be available on the Github page. [Become a sponsor]

Contributing

Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Contributors

Code of Conduct

Everyone interacting in the DatabaseConsistency project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Changelog

DatabaseConsistency's changelog is available here.

Copyright

Copyright (c) Evgeniy Demin. See LICENSE.txt for further details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubyactiverecordconsistencydatabaseoptimization

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架