Omitting 'username' in user registration

The application I am working on in needs minimal user information during registration to attract more people. Thus I would like to avoid asking for username from user during registration.

I am concerned about which would be the ideal way to achive this.

  • I could make the username optional (I guess this would be doable by modifying the users schema) but I am afraid that this could break the users-permissions plugin as it could rely on the fact that username is always required and unique.
  • Another way could be using a middleware during registration that assigns user email to username property as well. In this case username and email would have the same value, at least after the registration. Is there any pitfall into following this?
  • Another way is to add a BEFORE INSERT TRIGGER in MySQL. This trigger could add a username like user${id} to the new user. However this is a low level approach because it is applied on MySQL, and I would like to avoid it or implement it somehow differently.
  • Could be done also with MySQL transaction in the users-permissions controller (I mean first insert with empty username (or with a unique value) then update the username based on what I read from id).

Is there any advise on which is the best way to do this? Maybe some other approach I haven’t thought of could be really better and cleaner
If this is of importance, I am also planning to use social login through some of the authentication providers natively offered.