add validation in migation file ruby on rails code example Example: ruby on rails db migrate rails db:migrate