Passwords!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
-- name: CreateUser :one
|
||||
INSERT INTO users (id, created_at, updated_at, email)
|
||||
VALUES (gen_random_uuid(), NOW(), NOW(), $1)
|
||||
INSERT INTO users (id, created_at, updated_at, email, hashed_password)
|
||||
VALUES (gen_random_uuid(), NOW(), NOW(), $1, $2)
|
||||
RETURNING *;
|
||||
2
sql/queries/GetUserByEmail.sql
Normal file
2
sql/queries/GetUserByEmail.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
-- name: GetUserByEmail :one
|
||||
SELECT * FROM users WHERE email = $1;
|
||||
5
sql/schema/003_app_hashed_password_to_users_table.sql
Normal file
5
sql/schema/003_app_hashed_password_to_users_table.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE users ADD COLUMN hashed_password TEXT NOT NULL DEFAULT 'unset';
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE users DROP COLUMN hashed_password;
|
||||
Reference in New Issue
Block a user