active_record_doctor
active_record_doctor copied to clipboard
Identify database issues before they hit production.
This is PostgreSQL specific. The problem is described here - https://github.com/fatkodima/online_migrations#adding-a-json-column. Also seems like `jsonb` is the preferred type and it also shows a better performance.
Indexes on booleans are not as useful as people tend to think. On my laptop using postgres (default configuration) index was only used when
Rails 6.1 [introduced](https://github.com/rails/rails/pull/40157) `dependent: :destroy_async` which allows to destroy associated records in the background. This is useful when the parent record has lots of associated records and destroying all of...
Case insensitivity in uniqueness validations was skipped in this gem, but this is a very popular problem. I remember I was trapped by this at least once. And there is...
On Rails 7 (and probably on Rails 6 too) with new app I will get following errors, when I run `bundle exec rails active_record_doctor:undefined_table_references`: ```bash ActionMailbox::InboundEmail references a non-existent table...
It is possible the user uses other types for primary keys, for example string `username` for `users` table, or client side generated uuid-like strings for some other tables, or external...
We can avoid creating our own method to get the VIEWs, since `data_source_exists?` already does this. And additionally this will allow for models to be backed by foreign tables in...
Fixes #99. I was able to run `active_record_doctor` on 2 OSS projects: `discourse` (medium sized) and `gitlab` (large sized). ### Discourse **Before** Num of queries: `6771` Runtime of `active_record_doctor` (checks...
We can use [`SchemaCache`](https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaCache.html) internally to not request the same information from the db over and over. I am sure, this will improve runtime on decent sizeable projects with many...
As part of our test suite we run ActiveRecordDoctor and also create anonymous subclasses of `ActiveRecord::Base` - the latter causes an exception in the former ``` Traceback (most recent call...