Database design for a time tracking application

Have a look at the Timesheet model on databaseanswers.org. This covers it nicely

Simply, a table with

  • Date
  • User (FK to User table)
  • Project (FK to Project table)
  • Time worked

The first 3 columns are PK.

Now, do you want to:

  • log activity eg Analysis, Coding, testing separately?
  • log project phases separately?
  • log non-project work eg training, holidays (eg user focus or project focus?)
  • ...

In our time tracking application, we save the start and end times of the work, too. We add a new row in the database for every single task on the specific day and calculate the sum before displaying it. Consider if this information will be useful in the future, it would be very hard to integrate that later. It's not too complicated to group the rows of a day.