john
john

Reputation: 35390

If I have a users table but want e-mails to be usernames, should I simply have email/password as columns?

Or should I have username, email, password and set save username also as email?

edit: I am not using email as the pk but am using a unique index on the email

I feel like if I decided to change to openid/usernames I can still do that in the future by adding another column

Upvotes: 1

Views: 87

Answers (2)

Jumbala
Jumbala

Reputation: 4944

I'd do email/password. And if you ever want to add usernames you can upgrade it then. No need to use extra fields if they're the same and you don't need them.

Upvotes: 2

Jesus Ramos
Jesus Ramos

Reputation: 23268

Might as well just have the email column since it functions as both, no point in repeating data in your table. Just remember DO NOT SAVE PASSWORDS AS CLEARTEXT :) Also you should have a Primary Key id column

Upvotes: 1

Related Questions