Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore or warn about models referencing non-existent internal Rails tables by default #77

Open
viktorianer opened this issue Dec 28, 2021 · 4 comments

Comments

@viktorianer
Copy link

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:

ActionMailbox::InboundEmail references a non-existent table or view named action_mailbox_inbound_emails
ActiveStorage::VariantRecord references a non-existent table or view named active_storage_variant_records
ActiveStorage::Blob references a non-existent table or view named active_storage_blobs
ActiveStorage::Attachment references a non-existent table or view named active_storage_attachments
ActionText::RichText references a non-existent table or view named action_text_rich_texts
ActionText::EncryptedRichText references a non-existent table or view named action_text_rich_texts

I think it is intended, but in many cases it should not be an error, because most new apps are not using those features a long time, if ever at all (e.g. InboundEmail).

The documentation says that those tables are ignored by default for other tasks.

Maybe it is too much to ignore them in this case, then it should be only a warning?!
Probably it is hard to detect, if those models are used and only in this case to produce an error?

@fatkodima
Copy link
Contributor

fatkodima commented Jan 1, 2022

The documentation says that those tables are ignored by default for other tasks.

Personally, I think that was not the best idea to ignore them by default, because it is possible to miss some flaws even for them (despite being developed by smart people etc, maybe you modified them by yourself, who knows?), for example, duplicate indexes or integer primary keys. I would prefer to have none of the tables ignored by default and the user should himself configure those if he decides to.

As for mentioned models, the same thought.

As an alternative, if you are not using active_storage, action_text, etc you can remove them from your application, reducing its size, by adding separate gems into Gemfile instead of gem "rails" and requiring specific gems in config/application.rb instead of require "rails/all". See https://github.com/rails/rails/blob/main/railties/lib/rails/all.rb
And those warnings will disappear.

@viktorianer
Copy link
Author

As I said, "Maybe it is too much to ignore them". And I am fine with the ideas like "And those warnings will disappear.". When it would be only a warning. But it is an error, stopping execution of following tasks.

@fatkodima
Copy link
Contributor

Yes, I mean "errors". They will disappear.

@viktorianer
Copy link
Author

I know what you mean. But in the most cases it still produces error on new projects, before I start to use those Models and features. With warnings it would be OK, because all following tasks would run as they should.

@gregnavis gregnavis added this to the Version 1.11 milestone Jul 7, 2022
@gregnavis gregnavis removed this from the Version 1.11 milestone Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants