I have 2 tables Users
and Events
.
The Users
table stores information about the users: name, email, etc. The Events
table has a list of events: registration, password reset, etc etc.
How can I map these two into a new table where I can store history about user activity.
Example user reset password, add a record to a third table called UserEvents
for example.
My problem is building this 3'rd table. So if I add to it a composite key userid and eventid, that won't be unique. as an user will reset a password multiple times, and will end up with a composite primary key of same userid and save eventid.
User Table has the following columns:
- UserId (PK)
- Name
Event Table has the following columns:
- EventId (PK)
- Name
- Description
Should the UserEvent table be like this:
- Id (PK) - generated or identity type
- UserId (FK to User table - UserId)
- EventId (FK to Event table - EventId)
I will use EF7 code first approach.
mysql
,postgresql
,sql-server
,oracle
ordb2
- or something else entirely. – marc_s