# Missing NOT NULL and uniqueness constraints in DB

**URL:** <https://meta.discourse.org/t/missing-not-null-and-uniqueness-constraints-in-db/125945>\
**Category:** Development\
**Created:** [16 באוגוסט,‏ 2019,‏ 3:53am UTC](https://meta.discourse.org/t/missing-not-null-and-uniqueness-constraints-in-db/125945 "2019-08-16T03:53:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [16 באוגוסט,‏ 2019,‏ 5:05am UTC](https://meta.discourse.org/t/missing-not-null-and-uniqueness-constraints-in-db/125945/2 "2019-08-16T05:05:38Z")

</div>

> [@Utsav](#):
>
> validates\_uniqueness\_of :name, case\_sensitive: false

Case insensitive unique constraints are a bit tricky, I am uneasy adding the `citext` extension for this and we would be forced then to go `name_lower` and dupe the column just to add the index.

> [@Utsav](#):
>
> validates :word, presence: true, uniqueness: true, length: { maximum: 50 }

Yeah we should fix this

> [@Utsav](#):
>
> Finally, _WebHookEventType - name_ . ( `app/models/web_hook_event_type.rb` ):

Also fine to add an index here.

---

_[View the full topic](https://meta.discourse.org/t/missing-not-null-and-uniqueness-constraints-in-db/125945)._
