litestream 0.7.2-x86_64-linux → 0.8.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: 3fc80c60f00f49af0aa809eb1105a801c456e4ce7a1c025fb52b006316a86fc5
4
- data.tar.gz: 15745f36c2e10d154e109763de84098285eeb4d2c5b4c8464b171eb597510817
3
+ metadata.gz: 59ebcfd0c3df7580a084e4f35f7708dc46a880eb8d7d37f901caa17f57b55066
4
+ data.tar.gz: '0219c9889dc659291a19f318ba135b7fb2d1cd61796a7a5d66e5b62e5246afdd'
5
5
  SHA512:
6
- metadata.gz: bf8212c25a33f8c0b6d0724384409991fa94822be7b4054c62bc790d4cbf4755e347e4f253b01865d02e9016c4290cbdcf608299f0f62b927b232e3ffeb17a3d
7
- data.tar.gz: 55f6ec8f7c9f1c5071533fd47a207011a0a2d18bc8361de85e1249acef07b7e19b1d0c6bea86b2c1a86a1768fcfffec82458ef7d24602fcaf83774793385a7a2
6
+ metadata.gz: 2d24fc0f963181ffb7a66a4a76b8698ccf6b2dc9ad63fd7049a66a2366070ed30a1b2bd6761af2074a92cb8e2375b48cdb096762c37a75cd7cb87779e6363937
7
+ data.tar.gz: 247d6831b3c9c12d75ca4b6a65ebf51f7b0e43993bb1a91a363daf2b8fd24db46aee6a939ed12b56567994eb48428892606f61eea8176332f9056d7489793376
@@ -102,16 +102,29 @@ module Litestream
102
102
  }.merge(argv)
103
103
  restore(database, async: false, **args)
104
104
 
105
- restored_tables_count = `sqlite3 #{backup} "select count(*) from sqlite_schema where type='table';"`.chomp.to_i
106
- restored_size = File.size(backup)
107
- original_tables_count = `sqlite3 #{database} "select count(*) from sqlite_schema where type='table';"`.chomp.to_i
108
- original_size = File.size(database)
105
+ restored_schema = `sqlite3 #{backup} "select name, type from sqlite_schema;"`.chomp.split("\n")
106
+ restored_data = restored_schema.map { _1.split("|") }.group_by(&:last)
107
+ restored_rows_count = restored_data["table"]&.sum { |tbl, _| `sqlite3 #{backup} "select count(*) from #{tbl};"`.chomp.to_i }
108
+
109
+ original_schema = `sqlite3 #{database} "select name, type from sqlite_schema;"`.chomp.split("\n")
110
+ original_data = original_schema.map { _1.split("|") }.group_by(&:last)
111
+ original_rows_count = original_data["table"]&.sum { |tbl, _| `sqlite3 #{database} "select count(*) from #{tbl};"`.chomp.to_i }
109
112
 
110
113
  Dir.glob(backup + "*").each { |file| File.delete(file) }
111
114
 
112
115
  {
113
- "size" => {"original" => original_size, "restored" => restored_size},
114
- "tables" => {"original" => original_tables_count, "restored" => restored_tables_count}
116
+ "original" => {
117
+ "path" => database,
118
+ "tables" => original_data["table"]&.size,
119
+ "indexes" => original_data["index"]&.size,
120
+ "rows" => original_rows_count
121
+ },
122
+ "restored" => {
123
+ "path" => backup,
124
+ "tables" => restored_data["table"]&.size,
125
+ "indexes" => restored_data["index"]&.size,
126
+ "rows" => restored_rows_count
127
+ }
115
128
  }
116
129
  end
117
130
 
@@ -1,3 +1,3 @@
1
1
  module Litestream
2
- VERSION = "0.7.2"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -96,15 +96,20 @@ namespace :litestream do
96
96
 
97
97
  puts <<~TXT if result
98
98
 
99
- size
100
- original #{result["size"]["original"]}
101
- restored #{result["size"]["restored"]}
102
- delta #{result["size"]["original"] - result["size"]["restored"]}
103
-
104
99
  tables
105
- original #{result["tables"]["original"]}
106
- restored #{result["tables"]["restored"]}
107
- delta #{result["tables"]["original"] - result["tables"]["restored"]}
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"]}
108
113
  TXT
109
114
  end
110
115
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litestream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Stephen Margheim