From 9c42269b6217f8448ccffe5c17a1dc57fa0937ba Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sat, 26 Jan 2019 11:37:33 +0000 Subject: [PATCH] fixes: correct users importing id (#645) @princemaple could you try out this branch to see if it works on your end? --- cmd/users_import.go | 4 ++++ storage/bolt/importer/users.go | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/users_import.go b/cmd/users_import.go index f1c873af..ea84beab 100644 --- a/cmd/users_import.go +++ b/cmd/users_import.go @@ -70,6 +70,10 @@ list or set it to 0.`, checkErr(usernameConflictError(user.Username, conflictuous.ID, user.ID)) } } + } else { + // If it doesn't exist, set the ID to 0 to automatically get a new + // one that make sense in this DB. + user.ID = 0 } err = d.store.Users.Save(user) diff --git a/storage/bolt/importer/users.go b/storage/bolt/importer/users.go index 5a98ffb9..e84f85d6 100644 --- a/storage/bolt/importer/users.go +++ b/storage/bolt/importer/users.go @@ -55,7 +55,6 @@ func convertUsersToNew(old []*oldUser) ([]*users.User, error) { for _, oldUser := range old { user := &users.User{ - ID: uint(oldUser.ID), Username: oldUser.Username, Password: oldUser.Password, Scope: oldUser.Scope,