- New feature: detector to find tables without a primary key (contributed by fatkodima).
- Enhancement:
extraneous_indexestakes into account theINCLUDEpart of index definitions (contributed by fatkodima). - Enhancement:
missing_presence_validationtakes a new settingignore_columns_with_default(contributed by fatkodima). - Enhancement:
missing_unique_indexessupports HABTM associations (contributed by fatkodima). - Enhancement:
missing_non_null_constraintsupport STI columns (contributed by fatkodima). - Enhancement:
missing_non_null_contraintsupportsbelongs_to_required_validates_foreign_key(contributed by fatkodima). - Enhancement:
ignore_modelscan be passed class objects (contributed by fatkodima). - Bug fix: avoid false positives on missing case-insensitive uniqueness indexes
when using Postgres
citextstrings (contributed by gee-forr).
- Enhancement: the default configuration file has the .rb suffix to help editors automatically recognize the content Ruby (contributed by Jon Dufresne).
- New feature: regexp-based ignore settings (contributed by fatkodima).
- Bug fix: ignore_columns is correctly handed in missing_unique_indexes ( contributed by fatkodima).
- Bug fix: primary keys are automatically recognized as indexed and unique by unindexed_foreign_keys and missing_unique_indexes (contributed by fatkodima).
- Bug fix: a typo in the description of incorrect_boolean_presence_validation is fixed (contributed by Jon Dufresne).
- New feature: detect extraneous indexes on PostgreSQL materialized views (contributed by fatkodima).
- New feature: support for case-insensitive validations in
missing_unique_indexes(contributed by fatkodima). - New feature: support for has_one in
missing_unique_indexes(contributed by fatkodima). - New feature: support for async options in
incorrect_dependent_option(contributed by fatkodima). - Bug fix: make Rake integration work in non-Rails projects (contributed by fatkodima).
- Bug fix: ignore inherited validations in
missing_unique_indexes(contributed by fatkodima). - Bug fix: make
extraneous_indexeswork on expression indexes (contributed by fatkodima). short_primary_keytype checks only integer indexes as they are the ones at the risk of running out (contributed by fatkodima).unindexed_foreign_keyslooks at actual foreign keys, instead of guessing based on column name (contributed by fatkodima).- Improvements and clarifications to documentation and error messages (contributed by Kurtis Rainbolt-Greene, Vincent Glennon, and fatkodima).
- New feature: support for polymorphic associations in
missing_non_null_constraint(contributed by fatkodima). - New feature: support for foreign tables in PostgreSQL (contributed by fatkodima).
- New feature: debug logging for easier troubleshooting.
- Bug fix:
incorrect_length_validationused to take the first length validator on the model, even if it didn't correspond to the column under consideration. This is no longer the case (contributed by Julián Lires). - Bug fix: inclusion and exclusion validators can contain a proc in in: or within: which makes them impossible to analyze by active_record_doctor; such validations are now skipped (contributed by fatkodima).
- Fixed to documentation for
incorrect_dependent_option(contributed by Erick Santos). - Bug fix:
mismatched_foreign_key_typeused to always look at the type of the primary key in the other table, even if the foreign key was referencing a different column; the right column is now taken into account (contributed by Bruno Gerotto). - Bug fix:
incorrect_dependent_optiondidn't work correctly on through: associations as it would look at the final model (instead of the join model); additionally, if the join model lacked the corresponding has_many association it would result inNoMethodError.
- New feature:
incorrect_length_validationdetector can identify text-column length mismatches between tables and models (suggested by fatkodima). - New feature: each detector can be enabled or disabled globally via the configuration file.
- Enhancement:
missing_non_null_constraintsandmissing_presence_validationrecognizedNOT NULLcheck constraints (contributed by fatkodima). - Enhancement:
missing_unique_indexis aware ofhas_oneassociations and recommends creating an index on the corresponding foreign key (contributed by fatkodima). - Bug fix:
missing_unique_indexescan be satisfied by creating an index on a sublist of scope + column. Previously, it'd not accept such sublists even though they're enough to guarantee uniqueness (contributed by fatkodima). - Bug fix: fix
missing_unique_indexescrashes on function indexes (contributed by fatkodima). - Bug fix:
short_primary_key_typeno longer complains about UUID primary keys (contributed by fatkodima). - Bug fix:
extraneous_indexeswas made aware of non-standard primary key names and partial indexes (contributed by fatkodima). - Bug fix:
extraneous_indexesproperly recognizes smaller indexes to be enough to guarantee uniqueness. Previously, it'd skip some smaller indexes and ask for a larger index to be created (contributed by fatkodima). - Bug fix:
unindexed_deleted_atcorrectly works on partial indexes intended to cover deleted columns. It no longer asks to create a contradictory condition (IS NULL AND IS NOT NULL) in those cases (contributed by fatkodima). - Bug fix:
incorrect_dependent_optionworks correctly on polymorphic associations. - Bug fix: recognize the PostGIS adapter as PostgreSQL (contributed by fatkodima).
- Bug fix: index generators use
index_name_length(defined by Active Record) to ensure index names aren't too long (contributed by fatkodima). - Tested against Ruby 3.1 via CI (contributed by Peter Goldstein).
- Documentation fixes (contributed by Alistair McKinnell and Kaleb Lape).
- New feature: support for project-specific configuration and Continuous Integration usage.
- New feature:
mismatched_foreign_key_typecan detect foreign keys using a different column type than the column they're referencing (contributed by fatkodima). - New feature:
short_primary_key_typecan detect primary keys that use short integer types and pose a risk of running out of IDs (contributed by fatkodima). - Enhancement:
missing_non_null_constraintcan now properly handle both STI and non-STI inheritance hierarchies (contributed by Greg Navis and fatkodima). - Enhancement:
incorrect_dependency_optionnow supportsbelongs_toassociations (contributed by fatkodima). - Enhancement: more built-in Rails tables are ignored by default.
- Bug fix: make
extraneous_indexestake index options into account when comparing them for equivalence (contributed by fatkodima). - Bug fix:
add_indexes_generatoruses the correct migration version. - Bug fix:
add_indexes_generattortruncates long index names (contributed by Dusan Orlovic). - Bug fix:
missing_unique_indexesreports tables instead of indexes - it didn't make sense to talk about indexes on models.
- New feature:
incorrect_dependency_optioncan detect cases sub-optimal or dangerous use of:delete_allor:destroyon associations (thanks to Dusan Orlovic for the contribution). - New feature:
allruns all tasks and exits with a zero status if there were no errors. - New feature: support for MySQL!
- Bug fix:
add_indexin Rails 6 now correctly adds version numbers to migrations (thanks to Tatsuya Hoshino for the fix). - Removed unnecessary dependencies on
railtiesandactivesupport.
- All rake tasks added by active_record_doctor have a description so that they
are now shown by
rake -T. - Bug fix:
incorrect_boolean_presence_validation, missing_non_null_constraint and missing_presence_validation skip models whose underlying tables don't exist (thanks to rhymes for the fix). - Bug fix: fix a bug in
incorrect_boolean_presence_validationthat caused exceptions (thanks to Eito Katagiri for the fix). - Bug fix: add a missing dependency on
activesupport(thanks to Yuto Ito for the fix). - Bug fix: make
missing_unique_indexeswork on custom validators (thanks to Max Schwenk for the fix). - Bug fix: make
missing_unique_indexesorder-independent so that it no longer reports false-positives when columns are reordered (thanks to rhymes for the fix).
- Bug fix: fix a bug in missing_non_null_constraint that resulted in false positives (thanks to Artem Chubchenko for the fix).
- New feature: detect incorrect boolean column presence validations (they must always use inclusion/exclusion instead of presence validators).
- Bug fix: don't report missing presence validations on boolean columns if they're properly validated for inclusion/exclusion.
- Bug fix: don't report missing presence validations if the validation is defined on the association instead of the foreign key column.
- Bug fix: report missing non-NULL constraints on foreign keys when the presence validation is defined on the association.
- Bug fix: make
missing_unique_indexeswork in Rails 6 (thanks to Hrvoje Šimić for the fix). - Enhancement: support view-backed models in
undefined_table_references.
- New feature: detect columns validated for presence but missing a non-NULL constraint at the database level.
- New feature: detect columns with a non-NULL constraint at the database level without the corresponding presence validation.
- Official support for Rubies 1.9.3+ and Rails 4.2+
- Skipping full-text indexes when detecting extraneous indexes (thanks Tom)
- Some improvements and fixes in README.md (thanks Jay)
- New feature: detect indexes unprepared for working with models supporting soft-delete (thanks to Jason Fleetwood-Boldt for suggesting this feature).
- Bug fix: only look for references to undefined tables on models that have a table name defined.
- New feature: detect models referencing undefined tables.
- Support for Rails 4.2, 5.0 and 5.1.
- Improve errors reported by add_index on malformed inputs.
- New feature: detect missing foreign key constraints.
- Support for Rails 5 (thanks @syndbg)
- New feature: report extraneous indexes on primary keys.
- Bug fix: properly recognise indexes on polymorphic associations (thanks for reporting @kvokka and @michaelachrisco)
- Bug fix: handle non-unique indexes correctly
- Clean up the documentation (thanks @Fryguy)
- Document how to detect extraneous indexes.
- Support Rubies lacking
Array#to_h. - Minor refactorings (thanks @mwsteb)
- New feature: detect extraneous indexes.
- Update the installation instructions.
- Bug fix: add
railsto development dependencies.
- Bug fix: add
raketo development dependencies.
- Bug fix: versions in Gemfile.lock.
- Bug fix: don't generate migrations with identical timestamps.
- Initial release.
- New feature: Detecting and indexing unindexed foreign keys.