Closed pirj closed 3 years ago
I like the idea of the check but it seems that you confused the gem with database_consistency.
Would you like to contribute with such idea?
confused the gem with database_consistency.
100% guilty. Do you want me to open an issue there and close this one, or can you transfer it there?
Would you like to contribute with such idea?
Absolutely. On my current project, we're going through the process of enforcing consistency, but it's not something that happens overnight. I'll surely be happy to improve the topic when I'm out of other things that database_consistency
can detect. Might be earlier, but no promises.
100% guilty. Do you want me to open an issue there and close this one, or can you transfer it there?
It's up to you 👍 As I'd like to see a PR some day 😄
Absolutely. On my current project, we're going through the process of enforcing consistency, but it's not something that happens overnight. I'll surely be happy to improve the topic when I'm out of other things that database_consistency can detect. Might be earlier, but no promises.
Thank you, take your time 👍 And let me know if you would need any help with that.
Hey @djezzzl ! :wave:
Cascade deletion is sometimes a very expensive operation. In case the association is defined as
dependent: :delete
, it is possible to rely on the database to perform the deletion instead. See:on_delete
/:on_update
.Disclaimer: I clearly understand that
dependent: :destroy
should remain ignored, asdestroy
also runs callbacks.Would it make sense to detect this and suggest changing the FK in such a way that the DB handles cascade deletion/nullification?
Sorry for not being verbose. I'd love to validate the idea with you first, and elaborate if you support it.