Skip to content

Commit

Permalink
Fix missing to update updated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkRunWu committed Dec 15, 2023
1 parent f4e0d06 commit 11bf4bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions internal/db/postgres/domain_verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func (q query[T]) GetDomainVerificationByName(ctx context.Context, domainName st

func (q query[T]) DeleteDomainVerification(ctx context.Context, id string, now time.Time) error {
_, err := q.ext.ExecContext(ctx, `
UPDATE domain_verification SET deleted_at = $1 WHERE id = $2
`, now, id)
UPDATE domain_verification SET deleted_at = $1, updated_at = $2 WHERE id = $3
`, now, now, id)
if err != nil {
return err
}
Expand Down Expand Up @@ -130,8 +130,9 @@ func (q query[T]) ListLeastRecentlyCheckedDomain(ctx context.Context, time time.
func (q query[T]) ScheduleDomainVerificationAt(ctx context.Context, id string, time time.Time) error {
_, err := q.ext.ExecContext(ctx, `
UPDATE domain_verification SET
will_check_at = $1
WHERE id = $2
`, time, id)
updated_at = $1,
will_check_at = $2
WHERE id = $3
`, time, time, id)
return err
}
7 changes: 4 additions & 3 deletions internal/db/sqlite/domain_verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func (q query[T]) GetDomainVerificationByName(ctx context.Context, domainName st

func (q query[T]) DeleteDomainVerification(ctx context.Context, id string, now time.Time) error {
_, err := q.ext.ExecContext(ctx, `
UPDATE domain_verification SET deleted_at = ? WHERE id = ?
`, now, id)
UPDATE domain_verification SET deleted_at = ?, updated_at = ? WHERE id = ?
`, now, now, id)
if err != nil {
return err
}
Expand Down Expand Up @@ -130,8 +130,9 @@ func (q query[T]) ListLeastRecentlyCheckedDomain(ctx context.Context, time time.
func (q query[T]) ScheduleDomainVerificationAt(ctx context.Context, id string, time time.Time) error {
_, err := q.ext.ExecContext(ctx, `
UPDATE domain_verification SET
updated_at = ?,
will_check_at = ?
WHERE id = ?
`, time, id)
`, time, time, id)
return err
}

0 comments on commit 11bf4bc

Please sign in to comment.