flippercloud / flipper

🐬 Beautiful, performant feature flags for Ruby.
https://www.flippercloud.io/docs
MIT License
3.66k stars 411 forks source link

Add ActiveRecord validations to mirror table NOT NULL constraint #859

Closed tmaier closed 6 months ago

tmaier commented 6 months ago

This is a minor thing in my opinion.

I use active_record_doctor to identify potential database issues or risks.

When I run $ bin/rake active_record_doctor after I added flipper-active_record, I received the following recommendations:

add a `presence` validator to Flipper::Adapters::ActiveRecord::Gate.feature_key - it's NOT NULL but lacks a validator
add a `presence` validator to Flipper::Adapters::ActiveRecord::Gate.key - it's NOT NULL but lacks a validator
add a `presence` validator to Flipper::Adapters::ActiveRecord::Feature.key - it's NOT NULL but lacks a validator

Ref. https://github.com/gregnavis/active_record_doctor?tab=readme-ov-file#detecting-missing-presence-validations

This pull request adds these validators.

bkeepers commented 6 months ago

Thanks @tmaier!