You can execute actual SQL in your migration (see http://stackoverflow.com/questions/4664520/how-do-i-add-a-check-constraint-in-a-rails-migration) but I don't think Rails provides an easy way to add this kind of constraint.  For now, it's fine to have the constraint at your model level only.