Skip to content

Commit

Permalink
Report rows affected in purge (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlynch authored Dec 31, 2024
1 parent f5176c5 commit fab4543
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions store/sqlite/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (s Store) deleteOrphanedRows() error {

// Delete rows from entries_data if they don't reference valid rows in
// entries. This can happen if the entry insertion fails partway through.
if _, err := s.ctx.Exec(`
rows, err := s.ctx.Exec(`
DELETE FROM
entries_data
WHERE
Expand All @@ -78,11 +78,17 @@ func (s Store) deleteOrphanedRows() error {
entries ON entries_data.id = entries.id
WHERE
entries.id IS NULL
)`); err != nil {
)`)
if err != nil {
return err
}

ra, err := rows.RowsAffected()
if err != nil {
return err
}

log.Printf("purge completed successfully")
log.Printf("purge completed successfully (%d rows affected)", ra)

return nil
}

0 comments on commit fab4543

Please sign in to comment.