updating models and tests to move more constraints out of Ruby and into database