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.
Strategies for cleaning databases in Ruby. Can be used to ensure a clean state for testing.
Online MySQL schema migrations
5.4 0.0 L4 ActiveRecord::DataIntegrity VS SchemaPlusSchemaPlus provides a collection of enhancements and extensions to ActiveRecord
5.2 1.7 L5 ActiveRecord::DataIntegrity VS PoloPolo travels through your database and creates sample snapshots so you can work with real world data in development.
Database validations for ActiveRecord
4.0 2.2 L5 ActiveRecord::DataIntegrity VS SecondBaseSeamless second database integration for Rails.
The tool to find inconsistency between models schema and database constraints.
Catch bad SQL queries before they cause problems in production
Sinatra app to monitor Redis servers.
Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll).
Postgres partitioning built on top of https://github.com/ankane/pgslice
* 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?
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.
group :development do ... gem 'activerecord-data_integrity', require: false end
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 ...
Check only specified database rules with
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
For now tool checks the following issues:
- [x] The lack of database foreign keys for belongs_to/has_many associations (
- [x] The lack of not-null constraint for the columns with presence validation (
- [x] Inclusion validated colums should have
enumdata type (
Roadmap (TODO & Help Wanted)
1) Support extra database issues, such as:
- [ ] presence of
dependendoption set for association and not confliction with underlying
ON DELETEoption 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
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/activerecord-data_integrity.
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
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.