# Plugin for check constraints?

**URL:** <https://www.ruby-forum.com/t/plugin-for-check-constraints/165293>\
**Category:** Rails\
**Created:** [April 11, 2009, 4:45pm UTC](https://www.ruby-forum.com/t/plugin-for-check-constraints/165293 "2009-04-11T16:45:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marnen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/67e7ee/32.png) [@marnen](https://www.ruby-forum.com/u/marnen)\
**Post date:** [April 11, 2009, 4:45pm UTC](https://www.ruby-forum.com/t/plugin-for-check-constraints/165293/1 "2009-04-11T16:45:04Z")

</div>

Hi everyone.

I have a quick question. I’m wondering if there’s a Rails plugin along  
the lines of foreign\_key\_migrations, but for check constraints. (I  
found mig-constraints already, but that’s apparently not maintained and  
doesn’t seem to work.) Basically, I’d like to be able to do something  
like

add\_column :rating, :integer, :check =\> ‘\<= 5’

and have the check constraint generated.

If no one can refer me to a suitable plugin, I think I’ll start hacking  
foreign\_key\_migrations to add this feature.

## Best,

Marnen Laibow-Koser  
removed\_email\_address@domain.invalid  
[http://www.marnen.org](http://www.marnen.org)
