add worknote created time
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
9
db/migrations/20250324195310_worknote_update.sql
Normal file
9
db/migrations/20250324195310_worknote_update.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
ALTER TABLE worknotes ADD COLUMN created_at DATETIME DEFAULT CURRENT_TIMESTAMP;
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
ALTER TABLE worknotes DROP COLUMN created_at;
|
||||
-- +goose StatementEnd
|
@@ -46,4 +46,5 @@ type Worknote struct {
|
||||
ID int64
|
||||
IncidentNumber string
|
||||
Note sql.NullString
|
||||
CreatedAt sql.NullTime
|
||||
}
|
||||
|
@@ -136,7 +136,7 @@ INSERT into worknotes (
|
||||
) VALUES(
|
||||
?, ?
|
||||
)
|
||||
RETURNING id, incident_number, note
|
||||
RETURNING id, incident_number, note, created_at
|
||||
`
|
||||
|
||||
type CreateWorkNoteParams struct {
|
||||
@@ -147,7 +147,12 @@ type CreateWorkNoteParams struct {
|
||||
func (q *Queries) CreateWorkNote(ctx context.Context, arg CreateWorkNoteParams) (Worknote, error) {
|
||||
row := q.db.QueryRowContext(ctx, createWorkNote, arg.IncidentNumber, arg.Note)
|
||||
var i Worknote
|
||||
err := row.Scan(&i.ID, &i.IncidentNumber, &i.Note)
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.IncidentNumber,
|
||||
&i.Note,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user