[core] Add indexes to migrations and uniqueness validation to models