Re-assign deleted users to Ghost user

Hello,

Thanks for the great product, team!

I recently migrated from source + MySQL installation to Omnibus package on our new server. It generally works fine. During the migration some data were lost, some accounts were not migrated, so now we have 20-30 missing accounts. It's not a great problem and we believe it might be easier to create new ones when they need it. Anyhow, there is one more point that's critical. Projects member management page does not work if it has any of deleted accounts. It just shows 500 error.

When I run sudo gitlab-rake gitlab:check I have no problem, but the problem is definitely related to deleted users.

Here are some stuff that might be useful:

➜  /home sudo gitlab-rake gitlab:check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 8.4.3 ? ... OK (8.4.3)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
Customers / XXX.com ... yes
...
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.5.3)
Git version >= 2.18.0 ? ... yes (2.18.1)
Git user has default SSH configuration? ... yes
Active users: ... 92

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Here is how the members are displayed:

customers_manage_members

But 500 error when I click on members management button.

I guess something is wrong with the Ghost user assignment, so I wonder if there is a script in rails console that would allow to update delete users to a new ghost user ID.

Thanks