diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/user.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -9,7 +9,7 @@ import ( func getNextUserId(db *sql.DB) (int, error) { - row := db.QueryRow("select max(userid) from users;") + row := db.QueryRow("select coalesce(max(userid), 0) from users;") if row.Err() != nil { return -1, row.Err() } @@ -19,7 +19,7 @@ func getNextUserId(db *sql.DB) (int, error) { if err != nil { return -1, err } - return id, nil + return id+1, nil } |