Description
Checks your ActiveRecord models to match data integrity principles and rules. Out of the box it enforces many issues such as the lack of foreign keys.
ActiveRecord::DataIntegrity alternatives and similar gems
Based on the "Database Tools" category.
Alternatively, view ActiveRecord::DataIntegrity alternatives based on common mentions on social networks and blogs.
-
Database Cleaner
Strategies for cleaning databases in Ruby. Can be used to ensure a clean state for testing. -
Large Hadron Migrator
Online MySQL schema migrations -
Seed dump
Rails 4/5 task to dump your data to db/seeds.rb -
Rails DB
Rails Database Viewer and SQL Query Runner -
Lol DBA
lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts. -
Active Record Doctor
Identify database issues before they hit production. -
Foreigner
Adds foreign key helpers to migrations and correctly dumps foreign keys to schema.rb -
Seed Fu
Advanced seed data handling for Rails, combining the best practices of several methods together. -
Squasher
Squasher - squash your old migrations in a single command -
Seedbank
Seedbank gives your seed data a little structure. Create seeds for each environment, share seeds between environments and specify dependencies to load your seeds in order. All nicely integrated with simple rake tasks. -
BatchLoader
:zap: Powerful tool for avoiding N+1 DB or HTTP queries -
DatabaseConsistency
The tool to avoid various issues due to inconsistencies and inefficiencies between a database schema and application models. -
Polo
Polo travels through your database and creates sample snapshots so you can work with real world data in development. -
SchemaPlus
SchemaPlus provides a collection of enhancements and extensions to ActiveRecord -
DatabaseValidations
Database validations for ActiveRecord -
Upsert
Upsert on MySQL, PostgreSQL, and SQLite3. Transparently creates functions (UDF) for MySQL and PostgreSQL; on SQLite3, uses INSERT OR IGNORE. -
SecondBase
Seamless second database integration for Rails. -
OnlineMigrations
Catch unsafe PostgreSQL migrations in development and run them easier in production (code helpers for table/column renaming, changing column type, adding columns with default, background migrations, etc). -
FastPage
Blazing fast pagination for ActiveRecord with deferred joins ⚡️ -
QueryTrack
Find time-consuming database queries for ActiveRecord-based Rails Apps -
Shiba
Catch bad SQL queries before they cause problems in production -
Redis Dashboard
Sinatra app to monitor Redis servers. -
Ruby Whatsapp SDK
Empower your communication with Whatsapp using the Cloud API and Ruby SDK. With our easy-to-use Whatsapp API, you can quickly create custom bots and streamline messaging. Get started today and see the difference in your communication process. -
Ruby PG Extras
Ruby PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more. -
PgDriveBackup
Simple solution to make encrypted with ccrypt PostgreSQL backups and storing on Google Drive API -
Perfect Shape
Perfect Shape is a collection of geometric algorithms that are mostly useful for GUI manipulation like checking containment of a point in popular geometric shapes such as rectangle, square, arc, circle, polygon, and paths containing lines, quadratic bézier curves, and cubic bezier curves. Also, some general math algorithms like IEEE-754 Remainder. -
Slack Smart Bot
Create a Slack bot that is smart and so easy to expand, create new bots on demand, run ruby code on chat, create shortcuts... The main scope of this gem is to be used internally in the company so teams can create team channels with their own bot to help them on their daily work, almost everything is suitable to be automated!! slack-smart-bot can create bots on demand, create shortcuts, run ruby code... just on a chat channel. You can access it just from your mobile phone if you want and run those tests you forgot to run, get the results, restart a server... no limits. -
ActiveRecord Setops
Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll). -
PgDice
Postgres partitioning built on top of https://github.com/ankane/pgslice -
SlackHook
A Simple Interface to Slack Incoming Webhooks Integrations -
Rapidity
Simple but fast Redis-backed distributed rate limiter. Allows you to specify time interval and count within to limit distributed operations. -
bundler-download
Bundler plugin for auto-downloading specified extra files after gem install
Learn any GitHub repo in 59 seconds
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of ActiveRecord::DataIntegrity or a related project?
README
ActiveRecord::DataIntegrity
Checks your ActiveRecord models to match data integrity principles and rules. Out of the box it detects many issues such as the lack of foreign keys.
Intallation
group :development do
...
gem 'activerecord-data_integrity', require: false
end
Quickstart
Run data_integrity
CLI-tool in your Rails project's folder:
cd ~/amplifr
bundle exec data_integrity
It will load the Rails application, check the data integrity issues and give the similar output:
BelongsTo/ForeignKey: Label belongs_to project but has no foreign key to projects.id
Accordance/TablePresence: Stat::Hourly has no underlying table hourly_stats
...
Options
Check only specified database rules with --only
options:
bundle exec data_integrity --only HasMany/ForeignKey,BelongsTo/ForeignKey
Check only specified model with the list of the model full with:
bundle exec data_integrity --only HasMany/ForeignKye Billing::Account User
Supported Issues
For now tool checks the following issues:
- [x] The lack of database foreign keys for belongs_to/has_many associations (
HasMany/ForeignKey
andBelongsTo/ForeignKey
rule) - [x] The lack of not-null constraint for the columns with presence validation (
Validation/Presence
rule) - [x] Inclusion validated colums should have
enum
data type (Validation/Inclusion
rule)
Roadmap (TODO & Help Wanted)
1) Support extra database issues, such as:
- [ ] presence of
dependend
option set for association and not confliction with underlyingON DELETE
option of foreign key contraint - [ ] check for foreign keys to have bigint data type
- [ ] presence of index for the foreign keys search
- [ ] checks for paranoia models and indexes exclusion "removed" rows
2) Config for exluding some rules for the specific models (rubocop like)
3) Autofix for the fixing the issue, mostly by generating safe migrations
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/activerecord-data_integrity.
Run tests
The easiest way to tests up and running is to use handy dip gem with Docker and Docker Compose:
gem install dip
git checkout [email protected]:dsalahutdinov/activerecord-data_integrity.git
cd activerecord-data_integrity
dip provision
dip rspec
Otherwise (without Docker) set up environment manually:
git checkout [email protected]:dsalahutdinov/activerecord-data_integrity.git
cd activerecord-data_integrity
bundle install
bundle appraisal
DB_HOST=localhost DB_NAME=testdb DB_USERNAME=postgres bundle appraisal rspec
License
The gem is available as open source under the terms of the MIT License.
*Note that all licence references and agreements mentioned in the ActiveRecord::DataIntegrity README section above
are relevant to that project's source code only.