summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/user.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/db/user.go b/db/user.go
index 61e05ad..27e6f89 100644
--- a/db/user.go
+++ b/db/user.go
@@ -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
}