Do I need one or two unique key indexes for this table?

I am trying to create a Users table that only has OpenId registration, just like StackOverflow.

I store in a table

  • OpenId (username)
  • Nickname (which is the display name to show to the public)
  • Some other openId functions

So ... I want to make sure that there is only one user on the system who has an openId and only one alias.

Of course, I can change my nickname at any time. I could also change my openId at any time. I need to make sure they are unique / exist only once.

SO ... Am I creating TWO unique key indexes on a table, or one unique key index with both fields in it?

Cheers :)

0


source to share


2 answers


One for each of them.

If you only create one that contains both, you can have - for example - two users with the same alias if they have two different OpenIDs.



However:

  • I would suggest that you create one user table and another OpenID table that allows users to associate more than one OpenID with their account. Let's say they have an OpenID at Yahoo and another one at MyOpenID. If - for any reason - Yahoo decides to close its OpenID service, the person can still log in with their MyOpenID Login. Well, for now, he registered this ID with his account earlier.
+1


source


Make two unique keys. Otherwise, the same openid can have more than one user.



+1


source







All Articles