1

I have two tables, login_inf (information about login) and history (history of changes in database, for example which user edited specified row) - picture below:

enter image description here

I want to know which user did a specified action, which user added a row (created_by), which user edited a row (modified_by) and which user deleted a row (removed_by). Is my schema correct?

Relations:

history.created_by <-> login_inf.login

history.modified_by <-> login_inf.login

history.removed_by <-> login_inf.login

So these three columns in table history are one column from login_inf, I just changed the name.

Nick
  • 7,103
  • 2
  • 21
  • 43
mpj
  • 327
  • 1
  • 2
  • 12

1 Answers1

0

Your schema looks ok. Keep in mind that you will need to enforce insertion into your history table via triggers or code, and this can bog down your database heavily if you have a lot of changes. Your history table can also grow very large.

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
  • Thank you for responding :) I have triggers for generate rows in my table `history` and I know that it will slow down my database. I think that this table will be clean up after few months, because data in this table won't be useful anymore :) – mpj Aug 04 '16 at 19:48