litestream 0.7.2-arm64-linux → 0.8.0-arm64-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: 0ed179d2e6a5cbb1673c16ce9f56e0e412dcdc4c165caaaa058f48f542e0f21b
4
- data.tar.gz: 1c3e243958545df6d317ca993f007129835b5437fbbcb9b87b7b8deb8518a591
3
+ metadata.gz: 2ae1d36e2af07c9ada567ecc17ef63e3cd7e64bc592037a2a5b44e31444ec352
4
+ data.tar.gz: 230e9dd10f632a2f9d643aad71cdb393b9f207ca38dacc2dc4a020c7f5ab7651
5
5
  SHA512:
6
- metadata.gz: 8b0b7cacf18a7a089bfe785992bbd793174d194166b02f75f896630f8d4820ae8ef77abd541732c4bd876d27339885465660b4d3bb858cec2f0d9d9da8c3992d
7
- data.tar.gz: 70ce1401f2a65964479cbbc9b46c3259980e1b69507f0a1871d5b9c69af3ffa078808c8dc9bb02756484a895b968caf7cc42bd368636454d33d6cca08a7074c9
6
+ metadata.gz: b5deb3400dbea423d001b07721d8b6fc6a5ff7041c265daad51f1f6903c62a27f8b1298ded0723b04ccb536a333a35d8a216d97504e54271d3d643173245fe68
7
+ data.tar.gz: ce32a0be347daa00474715215bb5afd7ff768c796fc56efa8357988b83e544560e2a986b7cded6785f768eeeee39c610a377afb15e65a02c368e812bdc3b7f0e
@@ -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: arm64-linux
6
6
  authors:
7
7
  - Stephen Margheim