UID/GID generation is racy and reuses ids
If two users (or groups) are created at the same time one will fail with an IntegrityError
because get_next_unix_uid
(obviously) returns the same value.
Also get_next_unix_uid
returns max(User.unix_id) + 1
, i.e. if the most recently created user is deleted, its UID is reused. The same applies to get_next_unix_gid
.
Since everything is in the database now, we should try to fix this.