fix: resolve user registration error by fixing database queries

- Update CreateUser query to explicitly select only existing columns
- Update all user SELECT queries to explicitly select columns to avoid scan_frequency_minutes column issues
- Add GetUserForLogin query that includes password_hash for authentication
- Update login handler to use GetUserForLogin instead of GetUserByEmailOrUsername
- This prevents errors when migration hasn't been applied yet, allowing user registration to work
This commit is contained in:
2026-01-23 11:06:56 -05:00
parent a5e96ddb0b
commit fcc9b0f0b3
4 changed files with 91 additions and 34 deletions
+7 -4
View File
@@ -1,16 +1,19 @@
-- name: CreateUser :one
INSERT INTO users (email, username, password_hash, theme)
VALUES ($1, $2, $3, $4)
RETURNING *;
RETURNING id, email, username, theme, created_at, updated_at;
-- name: GetUserByEmail :one
SELECT * FROM users WHERE email = $1;
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE email = $1;
-- name: GetUserByUsername :one
SELECT * FROM users WHERE username = $1;
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE username = $1;
-- name: GetUserByEmailOrUsername :one
SELECT * FROM users WHERE email = $1 OR username = $1;
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE email = $1 OR username = $1;
-- name: GetUserForLogin :one
SELECT id, email, username, password_hash, theme, created_at, updated_at FROM users WHERE email = $1 OR username = $1;
-- name: GetUser :one
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE id = $1;