litestream 0.8.0-x86_64-linux → 0.9.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59ebcfd0c3df7580a084e4f35f7708dc46a880eb8d7d37f901caa17f57b55066
4
- data.tar.gz: '0219c9889dc659291a19f318ba135b7fb2d1cd61796a7a5d66e5b62e5246afdd'
3
+ metadata.gz: 7ce26bfd1f1653d96303a109f652aa041f24eeb11b8df7a64ad1172f1630adf0
4
+ data.tar.gz: 3570aa252e1a755c6dc78bc5e720fda47fc7ea340d0a81ab816a766056757f18
5
5
  SHA512:
6
- metadata.gz: 2d24fc0f963181ffb7a66a4a76b8698ccf6b2dc9ad63fd7049a66a2366070ed30a1b2bd6761af2074a92cb8e2375b48cdb096762c37a75cd7cb87779e6363937
7
- data.tar.gz: 247d6831b3c9c12d75ca4b6a65ebf51f7b0e43993bb1a91a363daf2b8fd24db46aee6a939ed12b56567994eb48428892606f61eea8176332f9056d7489793376
6
+ metadata.gz: 8d0ddf78cfc460f6652b8664b0f31246b745451b01f675695fb28cba646874bca31e39c62af51363ddc99e45dd023fdd0e2cec0efbd9a888009e0318f3ba5dd1
7
+ data.tar.gz: 57520e534e247b47b3898269b3c36dc754869694c9ad2cb896292ee6bb66b6c5fcb56691d64030ef6d7831b991b3b264e1775304cff355ca14c7d754e13ad12e
@@ -1,3 +1,3 @@
1
1
  module Litestream
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -93,23 +93,53 @@ namespace :litestream do
93
93
  options.symbolize_keys!
94
94
 
95
95
  result = Litestream::Commands.verify(database, async: true, **options)
96
-
97
- puts <<~TXT if result
98
-
99
- tables
100
- original #{result["original"]["tables"]}
101
- restored #{result["restored"]["tables"]}
102
- delta #{result["original"]["tables"] - result["restored"]["tables"]}
103
-
104
- indexes
105
- original #{result["original"]["indexes"]}
106
- restored #{result["restored"]["indexes"]}
107
- delta #{result["original"]["indexes"] - result["restored"]["indexes"]}
108
-
109
- rows
110
- original #{result["original"]["rows"]}
111
- restored #{result["restored"]["rows"]}
112
- delta #{result["original"]["rows"] - result["restored"]["rows"]}
113
- TXT
96
+ original_tables = result["original"]["tables"]
97
+ restored_tables = result["restored"]["tables"]
98
+ original_indexes = result["original"]["indexes"]
99
+ restored_indexes = result["restored"]["indexes"]
100
+ original_rows = result["original"]["rows"]
101
+ restored_rows = result["restored"]["rows"]
102
+
103
+ same_number_of_tables = original_tables == restored_tables
104
+ same_number_of_indexes = original_indexes == restored_indexes
105
+ same_number_of_rows = original_rows == restored_rows
106
+
107
+ if same_number_of_tables && same_number_of_indexes && same_number_of_rows
108
+ puts "Backup for `#{database}` verified as consistent!\n" + [
109
+ " tables #{original_tables}",
110
+ " indexes #{original_indexes}",
111
+ " rows #{original_rows}"
112
+ ].compact.join("\n")
113
+ else
114
+ abort "Verification failed for #{database}:\n" + [
115
+ (unless same_number_of_tables
116
+ if original_tables > restored_tables
117
+ diff = original_tables - restored_tables
118
+ " Backup is missing #{diff} table#{"s" if diff > 1}"
119
+ else
120
+ diff = restored_tables - original_tables
121
+ " Backup has extra #{diff} table#{"s" if diff > 1}"
122
+ end
123
+ end),
124
+ (unless same_number_of_indexes
125
+ if original_indexes > restored_indexes
126
+ diff = original_indexes - restored_indexes
127
+ " Backup is missing #{diff} index#{"es" if diff > 1}"
128
+ else
129
+ diff = restored_indexes - original_indexes
130
+ " Backup has extra #{diff} index#{"es" if diff > 1}"
131
+ end
132
+ end),
133
+ (unless same_number_of_rows
134
+ if original_rows > restored_rows
135
+ diff = original_rows - restored_rows
136
+ " Backup is missing #{diff} row#{"s" if diff > 1}"
137
+ else
138
+ diff = restored_rows - original_rows
139
+ " Backup has extra #{diff} row#{"s" if diff > 1}"
140
+ end
141
+ end)
142
+ ].compact.join("\n")
143
+ end
114
144
  end
115
145
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litestream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Stephen Margheim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-02 00:00:00.000000000 Z
11
+ date: 2024-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logfmt