litestream 0.8.0-arm64-darwin → 0.9.0-arm64-darwin

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: 4bd8feb6f82008689f3cad5a69e865b7def1a4121fcee16d0747e00d03a8869c
4
- data.tar.gz: 11d7c72374683949ad7fa09a8681620660c8f3b1f88c947e8540e857d37852b8
3
+ metadata.gz: 7ae7ada05f79c43a91fe4dab24d78e0f540594f149b81c158ae8c9de9a5e0102
4
+ data.tar.gz: 3663ac9db5970fdcd0c6ca4061107bb4617470c8a9eae92dd081fd2976a01305
5
5
  SHA512:
6
- metadata.gz: a949d16e20c45b88440608ed5da90883b11a3cba91c02282bc2ac8d740b1672c1d48223a1b955e79979ae1bf7b1253c6231058d6d4c634e62faa49f3e2b87c6d
7
- data.tar.gz: f86a1d8590f1558ec671a2cbe382c89f89ea6f012a600c11230a0219697c75c28ba6db112050b593c4f2ba32849032bc174b4614ce28610e9f672856fb63d7df
6
+ metadata.gz: e2288c916563650e6ce7fc341b60782811bffa01f25fb7c9b1c77b7b4d777cacacd76c0db62ffd5f2e1a09535449f22dfd785d9e36a0dc1198eed2a4008dfd5b
7
+ data.tar.gz: ae1e4efb3bf1e6d0a7bc6d5a0bf181c1f542aabaec5ce585988701e4de1b71c78e55422a59405b24e35720a920b90e8005b033733d6646b47cb643d5e05bf5ca
@@ -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: arm64-darwin
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