Importing users

In the importation scripts (at least the CSV one), I see that there is an option to add a prefix to the user id - presumably to avoid clashing with existing user ids.

Let’s say I have current 500 users on discourse and I want to import 1000 users via the CSV script. Let’s say I use a prefix of ‘1’ for the import script so the new users have userid 1000 to 2000.

What happens when the organic signups hit userid 1000? Would this create any issue or would the software automatically add the new user to id 2001?

I’m trying to work out if I need to put a very high prefix to avoid this issue.

It doesn’t matter. It’s s problem only if you import from multiple sources and they clash. They be assigned a new Discourse user id, so that’s not a problem.

2 Likes

When I looked at the database table for users I saw:

id | integer | | not null | nextval('users_id_seq'::regclass)

So I think if the importation script doesn’t follow the sequence or reset the sequence higher, then you could get a duplicate key and fail.

Hopefully the importation script you use respects the sequence and doesn’t insert into the database ‘blindly’.

The imported users are assigned new Discourse ids. The ids in your csv are saved in a user custom field, but have nothing to do with the discourse user_id.