database - Linking multiple Ids to one Ids that belongs to same user -


i have system in want generate unique user ids each user coming in system. if user changes device new id developed same user. so, in system, 2 different users actually, not. if have email users , not all, how can link these 2 ids together?

it's quite hard answer question because it's unclear you're asking, i'll try:)

there variants:

  1. you know in advance unique user identifier, i.e. email. new user should pass system during registration

  2. you know in advance unique user identifier, new user can finish registration without passing info

  3. you don't know in advance unique user identifier

first case quite simple - should unique user id (email) instead of generated unique id. can match new user , old 1 unique identifier right during registration process. example try link social account during registration , message such email has been used.

second case more difficult - can add email field in user table , add index on it. in case can run simple query find not unique user. or can maintain separate match table looks (email, user_id). example can contain such rows:

|   email        | user_id| +----------------+--------+ |user@example.com|   1    |   |user@example.com|   2    | |test@example.com|   3    | | .............. | ...... | 

in table can add rows when information unique user identifier (email in our case). table have matching between different generated users through user unique identifier (email in our case)

third case more complicated first , second:) can't create matching table in advance because don't know user unique identifier.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -