Theoretical design of the user table - bounswe/bounswe2015group5 GitHub Wiki

User table

User table shall have following fields:

  • user id: An integer. Distinct for all entries.
  • email: Email address. (A string that matches this regular expression: ^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$) Distinct for all entries.
  • hashed password: A string representation of the hash value of the user's password.
  • given name: Given name of the user. (string)
  • surname: Surname of the user. (string)

I omitted a possible username field on purpose. I find logging in with email address much more convenient than logging in with a username. Other than logging in we can display user's full name wherever identification is necessary.

User specialty table

A user may have several specialties. So we will have a separate table for those.

User specialty table shall have following fields:

  • user id: Foreign key from user table.
  • specialty: A string describing one of user's specialties.

User interest table

A user may have several interests. So we will have a separate table for those.

User interest table shall have following fields:

  • user id: Foreign key from user table.
  • tag id: Foreign key from tag table. (Not yet designed)

We may this table's implementation until the tag table is designed and implemented.

Example

At that point, I find providing an example beneficial. Here a hypothetical state of those three tables in a 2 user environment:

Note that these are symbolic representations of the tables. For many practical reasons, in implementation we may want to have field names that doesn't contain empty spaces.

User table

user id email hashed password given name surname
1 [email protected] 263b4 Leisha Lehrman
2 [email protected] 61eb0 Roberto Rexford

User specialty table

user id specialty
1 Physician
2 Computer engineer
1 Motorcycle enthusiast
1 Franz Kafka expert

User interest table

user id tag id
1 73
2 12
2 190
1 762

In not-yet-implemented tag table those tag ids may correspond to following topics. 73: forensic medicine 12: political theory 190: polish justice system 762: Jean-Paul Sartre