Skip to content

Commit

Permalink
Merge pull request #30 from fractaledmind/fractaledmind-patch-1
Browse files Browse the repository at this point in the history
Ensure verify! reports the database that failed and returns true if verification passes
  • Loading branch information
fractaledmind authored May 5, 2024
2 parents af544c8 + e97df65 commit f05303a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/litestream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def verify!(database_path)
backup = SQLite3::Database.new(backup_path)
result = backup.execute("SELECT 1 FROM _litestream_verification WHERE uuid = ? LIMIT 1", sentinel) # => [[1]] || []

raise VerificationFailure, "Verification failed, sentinel not found" if result.empty?
raise VerificationFailure, "Verification failed for `#{database_path}`" if result.empty?

true
ensure
database.execute("DELETE FROM _litestream_verification WHERE uuid = ?", sentinel)
database.close
Expand Down

0 comments on commit f05303a

Please sign in to comment.