Add user names support: add first_name/last_name to users table and regenerate database queries
This commit is contained in:
@@ -64,4 +64,6 @@ type Users struct {
|
|||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
ScanFrequencyMinutes pgtype.Int4 `db:"scan_frequency_minutes" json:"scan_frequency_minutes"`
|
ScanFrequencyMinutes pgtype.Int4 `db:"scan_frequency_minutes" json:"scan_frequency_minutes"`
|
||||||
AutoScanEnabled pgtype.Bool `db:"auto_scan_enabled" json:"auto_scan_enabled"`
|
AutoScanEnabled pgtype.Bool `db:"auto_scan_enabled" json:"auto_scan_enabled"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ type Querier interface {
|
|||||||
UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error
|
UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error
|
||||||
UpdateReadingProgress(ctx context.Context, arg UpdateReadingProgressParams) (ReadingProgress, error)
|
UpdateReadingProgress(ctx context.Context, arg UpdateReadingProgressParams) (ReadingProgress, error)
|
||||||
UpdateScanSettings(ctx context.Context, arg UpdateScanSettingsParams) error
|
UpdateScanSettings(ctx context.Context, arg UpdateScanSettingsParams) error
|
||||||
|
UpdateUserProfile(ctx context.Context, arg UpdateUserProfileParams) error
|
||||||
UpdateUserTheme(ctx context.Context, arg UpdateUserThemeParams) error
|
UpdateUserTheme(ctx context.Context, arg UpdateUserThemeParams) error
|
||||||
UpdateUsername(ctx context.Context, arg UpdateUsernameParams) error
|
UpdateUsername(ctx context.Context, arg UpdateUsernameParams) error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,15 +129,17 @@ func (q *Queries) CreateEbookRating(ctx context.Context, arg CreateEbookRatingPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CreateUser = `-- name: CreateUser :one
|
const CreateUser = `-- name: CreateUser :one
|
||||||
INSERT INTO users (email, username, password_hash, theme)
|
INSERT INTO users (email, username, password_hash, first_name, last_name, theme)
|
||||||
VALUES ($1, $2, $3, $4)
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
RETURNING id, email, username, theme, created_at, updated_at
|
RETURNING id, email, username, theme, first_name, last_name, created_at, updated_at
|
||||||
`
|
`
|
||||||
|
|
||||||
type CreateUserParams struct {
|
type CreateUserParams struct {
|
||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
PasswordHash string `db:"password_hash" json:"password_hash"`
|
PasswordHash string `db:"password_hash" json:"password_hash"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,6 +148,8 @@ type CreateUserRow struct {
|
|||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -155,6 +159,8 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateU
|
|||||||
arg.Email,
|
arg.Email,
|
||||||
arg.Username,
|
arg.Username,
|
||||||
arg.PasswordHash,
|
arg.PasswordHash,
|
||||||
|
arg.FirstName,
|
||||||
|
arg.LastName,
|
||||||
arg.Theme,
|
arg.Theme,
|
||||||
)
|
)
|
||||||
var i CreateUserRow
|
var i CreateUserRow
|
||||||
@@ -163,6 +169,8 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateU
|
|||||||
&i.Email,
|
&i.Email,
|
||||||
&i.Username,
|
&i.Username,
|
||||||
&i.Theme,
|
&i.Theme,
|
||||||
|
&i.FirstName,
|
||||||
|
&i.LastName,
|
||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
)
|
)
|
||||||
@@ -398,7 +406,7 @@ func (q *Queries) GetScanSettings(ctx context.Context, id pgtype.UUID) (GetScanS
|
|||||||
}
|
}
|
||||||
|
|
||||||
const GetUser = `-- name: GetUser :one
|
const GetUser = `-- name: GetUser :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE id = $1
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
type GetUserRow struct {
|
type GetUserRow struct {
|
||||||
@@ -406,6 +414,8 @@ type GetUserRow struct {
|
|||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -418,6 +428,8 @@ func (q *Queries) GetUser(ctx context.Context, id pgtype.UUID) (GetUserRow, erro
|
|||||||
&i.Email,
|
&i.Email,
|
||||||
&i.Username,
|
&i.Username,
|
||||||
&i.Theme,
|
&i.Theme,
|
||||||
|
&i.FirstName,
|
||||||
|
&i.LastName,
|
||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
)
|
)
|
||||||
@@ -425,7 +437,7 @@ func (q *Queries) GetUser(ctx context.Context, id pgtype.UUID) (GetUserRow, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
const GetUserByEmail = `-- name: GetUserByEmail :one
|
const GetUserByEmail = `-- name: GetUserByEmail :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE email = $1
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE email = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
type GetUserByEmailRow struct {
|
type GetUserByEmailRow struct {
|
||||||
@@ -433,6 +445,8 @@ type GetUserByEmailRow struct {
|
|||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -445,6 +459,8 @@ func (q *Queries) GetUserByEmail(ctx context.Context, email string) (GetUserByEm
|
|||||||
&i.Email,
|
&i.Email,
|
||||||
&i.Username,
|
&i.Username,
|
||||||
&i.Theme,
|
&i.Theme,
|
||||||
|
&i.FirstName,
|
||||||
|
&i.LastName,
|
||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
)
|
)
|
||||||
@@ -452,7 +468,7 @@ func (q *Queries) GetUserByEmail(ctx context.Context, email string) (GetUserByEm
|
|||||||
}
|
}
|
||||||
|
|
||||||
const GetUserByEmailOrUsername = `-- name: GetUserByEmailOrUsername :one
|
const GetUserByEmailOrUsername = `-- name: GetUserByEmailOrUsername :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE email = $1 OR username = $1
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE email = $1 OR username = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
type GetUserByEmailOrUsernameRow struct {
|
type GetUserByEmailOrUsernameRow struct {
|
||||||
@@ -460,6 +476,8 @@ type GetUserByEmailOrUsernameRow struct {
|
|||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -472,6 +490,8 @@ func (q *Queries) GetUserByEmailOrUsername(ctx context.Context, email string) (G
|
|||||||
&i.Email,
|
&i.Email,
|
||||||
&i.Username,
|
&i.Username,
|
||||||
&i.Theme,
|
&i.Theme,
|
||||||
|
&i.FirstName,
|
||||||
|
&i.LastName,
|
||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
)
|
)
|
||||||
@@ -479,7 +499,7 @@ func (q *Queries) GetUserByEmailOrUsername(ctx context.Context, email string) (G
|
|||||||
}
|
}
|
||||||
|
|
||||||
const GetUserByUsername = `-- name: GetUserByUsername :one
|
const GetUserByUsername = `-- name: GetUserByUsername :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE username = $1
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE username = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
type GetUserByUsernameRow struct {
|
type GetUserByUsernameRow struct {
|
||||||
@@ -487,6 +507,8 @@ type GetUserByUsernameRow struct {
|
|||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -499,6 +521,8 @@ func (q *Queries) GetUserByUsername(ctx context.Context, username string) (GetUs
|
|||||||
&i.Email,
|
&i.Email,
|
||||||
&i.Username,
|
&i.Username,
|
||||||
&i.Theme,
|
&i.Theme,
|
||||||
|
&i.FirstName,
|
||||||
|
&i.LastName,
|
||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
)
|
)
|
||||||
@@ -535,7 +559,7 @@ func (q *Queries) GetUserEbookFolders(ctx context.Context, userID pgtype.UUID) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const GetUserForLogin = `-- name: GetUserForLogin :one
|
const GetUserForLogin = `-- name: GetUserForLogin :one
|
||||||
SELECT id, email, username, password_hash, theme, created_at, updated_at FROM users WHERE email = $1 OR username = $1
|
SELECT id, email, username, password_hash, theme, first_name, last_name, created_at, updated_at FROM users WHERE email = $1 OR username = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
type GetUserForLoginRow struct {
|
type GetUserForLoginRow struct {
|
||||||
@@ -544,6 +568,8 @@ type GetUserForLoginRow struct {
|
|||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
PasswordHash string `db:"password_hash" json:"password_hash"`
|
PasswordHash string `db:"password_hash" json:"password_hash"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -557,6 +583,8 @@ func (q *Queries) GetUserForLogin(ctx context.Context, email string) (GetUserFor
|
|||||||
&i.Username,
|
&i.Username,
|
||||||
&i.PasswordHash,
|
&i.PasswordHash,
|
||||||
&i.Theme,
|
&i.Theme,
|
||||||
|
&i.FirstName,
|
||||||
|
&i.LastName,
|
||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
)
|
)
|
||||||
@@ -623,7 +651,7 @@ func (q *Queries) ListEbooks(ctx context.Context, arg ListEbooksParams) ([]Ebook
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ListUsers = `-- name: ListUsers :many
|
const ListUsers = `-- name: ListUsers :many
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users ORDER BY created_at DESC
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users ORDER BY created_at DESC
|
||||||
`
|
`
|
||||||
|
|
||||||
type ListUsersRow struct {
|
type ListUsersRow struct {
|
||||||
@@ -631,6 +659,8 @@ type ListUsersRow struct {
|
|||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Username string `db:"username" json:"username"`
|
Username string `db:"username" json:"username"`
|
||||||
Theme pgtype.Text `db:"theme" json:"theme"`
|
Theme pgtype.Text `db:"theme" json:"theme"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -649,6 +679,8 @@ func (q *Queries) ListUsers(ctx context.Context) ([]ListUsersRow, error) {
|
|||||||
&i.Email,
|
&i.Email,
|
||||||
&i.Username,
|
&i.Username,
|
||||||
&i.Theme,
|
&i.Theme,
|
||||||
|
&i.FirstName,
|
||||||
|
&i.LastName,
|
||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
@@ -845,6 +877,21 @@ func (q *Queries) UpdateScanSettings(ctx context.Context, arg UpdateScanSettings
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UpdateUserProfile = `-- name: UpdateUserProfile :exec
|
||||||
|
UPDATE users SET first_name = $2, last_name = $3, updated_at = NOW() WHERE id = $1
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateUserProfileParams struct {
|
||||||
|
ID pgtype.UUID `db:"id" json:"id"`
|
||||||
|
FirstName pgtype.Text `db:"first_name" json:"first_name"`
|
||||||
|
LastName pgtype.Text `db:"last_name" json:"last_name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateUserProfile(ctx context.Context, arg UpdateUserProfileParams) error {
|
||||||
|
_, err := q.db.Exec(ctx, UpdateUserProfile, arg.ID, arg.FirstName, arg.LastName)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
const UpdateUserTheme = `-- name: UpdateUserTheme :exec
|
const UpdateUserTheme = `-- name: UpdateUserTheme :exec
|
||||||
UPDATE users SET theme = $2, updated_at = NOW() WHERE id = $1
|
UPDATE users SET theme = $2, updated_at = NOW() WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
-- name: CreateUser :one
|
-- name: CreateUser :one
|
||||||
INSERT INTO users (email, username, password_hash, theme)
|
INSERT INTO users (email, username, password_hash, first_name, last_name, theme)
|
||||||
VALUES ($1, $2, $3, $4)
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
RETURNING id, email, username, theme, created_at, updated_at;
|
RETURNING id, email, username, theme, first_name, last_name, created_at, updated_at;
|
||||||
|
|
||||||
-- name: GetUserByEmail :one
|
-- name: GetUserByEmail :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE email = $1;
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE email = $1;
|
||||||
|
|
||||||
-- name: GetUserByUsername :one
|
-- name: GetUserByUsername :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE username = $1;
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE username = $1;
|
||||||
|
|
||||||
-- name: GetUserByEmailOrUsername :one
|
-- name: GetUserByEmailOrUsername :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE email = $1 OR username = $1;
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE email = $1 OR username = $1;
|
||||||
|
|
||||||
-- name: GetUserForLogin :one
|
-- name: GetUserForLogin :one
|
||||||
SELECT id, email, username, password_hash, theme, created_at, updated_at FROM users WHERE email = $1 OR username = $1;
|
SELECT id, email, username, password_hash, theme, first_name, last_name, created_at, updated_at FROM users WHERE email = $1 OR username = $1;
|
||||||
|
|
||||||
-- name: GetUser :one
|
-- name: GetUser :one
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE id = $1;
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users WHERE id = $1;
|
||||||
|
|
||||||
-- name: GetUserPasswordHash :one
|
-- name: GetUserPasswordHash :one
|
||||||
SELECT password_hash FROM users WHERE id = $1;
|
SELECT password_hash FROM users WHERE id = $1;
|
||||||
|
|
||||||
-- name: ListUsers :many
|
-- name: ListUsers :many
|
||||||
SELECT id, email, username, theme, created_at, updated_at FROM users ORDER BY created_at DESC;
|
SELECT id, email, username, theme, first_name, last_name, created_at, updated_at FROM users ORDER BY created_at DESC;
|
||||||
|
|
||||||
-- name: GetEbook :one
|
-- name: GetEbook :one
|
||||||
SELECT * FROM ebooks WHERE id = $1;
|
SELECT * FROM ebooks WHERE id = $1;
|
||||||
@@ -75,6 +75,9 @@ DELETE FROM reading_progress WHERE ebook_id = $1 AND user_id = $2;
|
|||||||
-- name: UpdateUserTheme :exec
|
-- name: UpdateUserTheme :exec
|
||||||
UPDATE users SET theme = $2, updated_at = NOW() WHERE id = $1;
|
UPDATE users SET theme = $2, updated_at = NOW() WHERE id = $1;
|
||||||
|
|
||||||
|
-- name: UpdateUserProfile :exec
|
||||||
|
UPDATE users SET first_name = $2, last_name = $3, updated_at = NOW() WHERE id = $1;
|
||||||
|
|
||||||
-- name: UpdateUsername :exec
|
-- name: UpdateUsername :exec
|
||||||
UPDATE users SET username = $2, updated_at = NOW() WHERE id = $1;
|
UPDATE users SET username = $2, updated_at = NOW() WHERE id = $1;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- Add first and last name to users table
|
||||||
|
ALTER TABLE users ADD COLUMN first_name VARCHAR(255);
|
||||||
|
ALTER TABLE users ADD COLUMN last_name VARCHAR(255);
|
||||||
Reference in New Issue
Block a user