rails g model User name:index email:uniq token:string{6} age:integer
name:index
creates an indexed column calledname
.email:uniq
creates column calledemail
with a unique index.- Specifying
token:string{6}
constrains the length oftoken
to 6 chars.
class CreateUsers < ActiveRecord::Migration