djezzzl/database_consistency

Trouble understanding config file syntax

Closed this issue · 4 comments

Hi,

I'm having trouble understanding the expected config syntax, and whether what I'm seeing is a bug (or more likely a problem with my setup). Can I just confirm the behaviour of the following config files?

All:
  enabled: false

☝️ this will disable all checkers for all models - is that right?

UniqueIndexChecker:
  enabled: false

☝️ this will disable the UniqueIndexChecker for all models - is that right?

Currently neither of these are working for me. I wonder if perhaps the functionality I'm assuming above doesn't actually exist, and whether all config has to start with a model name? I'd be grateful if you could confirm either way.

Many thanks!

Hi @greytape,

First of all, thank you for using the gem.

The following will disable all checkers until a particular checker is enabled again.

DatabaseConsistencyCheckers:
 All:
   enabled: false

The following will disable UniqueIndexChecker.

DatabaseConsistencyCheckers:
  UniqueIndexChecker:
    enabled: false

You may check the example here: https://github.com/djezzzl/database_consistency/blob/master/rails6-example/.database_consistency.yml.

In order for the config file to be loaded automatically, it should have a specific name .database_consistency.yml.

Currently neither of these are working for me. I wonder if perhaps the functionality I'm assuming above doesn't actually exist, and whether all config has to start with a model name? I'd be grateful if you could confirm either way.

I'm thinking of several improvements to avoid this type of issue in the future:

  • improve the documentation
  • add database_consistency validate [config] option to validate provided configuration
  • output loaded configuration files

Maybe validation of the configuration file could also happen as part of the execution.

Please let me know if the answer helped you!
I'm closing the issue for now but feel free to reopen it again if needed. Have a great week!

Please also share what you think about my proposal on how to avoid such issues. And basically, I would be glad for any kind of feedback or ideas for the gem.

@djezzzl - thanks for such a speedy response. This is perfect - so glad that the functionality exists already.

While your options for validating/outputting configuration are interesting, I think in my case better documentation would have solved it. There is no mention of the use of DatabaseConsistencyCheckers in the Readme (nor the use of All - which I found out about through looking through the projects Issues).

I will open a PR with some suggested additions to the Readme - hope that's helpful.

Thank you for sharing your opinion!

I wanted to reorganize the documentation this week. Would you mind please having a look at that this weekend or some what next week and sharing your thoughts?