I have a table that holds various users by user_id
with many other indexed columns of ids from third-party tools they use.
For example, table users
user_id | user_name | zendesk_id | mailchimp_id | todoist_id
We have crons configured to hit these third parties for a list of users so that our db has any new users inserted. In the event of a user_name
change on the third party, we also want to update that information on our side to keep in sync.
user_id
is a primary key with auto-increment.
all third party service columns (ex. zendesk_id
) are unique and indexed.
Per mysql documentation, auto-increment will not work properly when other columns are indexed (see similar, but not duplicate question explaining this: ON DUPLICATE KEY + AUTO INCREMENT issue mysql )
Since mysql has this documented problem, my question is this:
How can I keep a reasonably clean auto-increment on user_id
when I am pulling full user lists from these third parties to insert new users and update existing users?