litestream 0.7.2-arm64-darwin → 0.8.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: 9dfffc3c0f402bd96f43fc2801edb03957712ca9c3fe25faf4de6900ad4aa49e
4
- data.tar.gz: b7515d580f591dbc4dca09c7344af9c84d2278aba72345c8567d8df14e0f9395
3
+ metadata.gz: 4bd8feb6f82008689f3cad5a69e865b7def1a4121fcee16d0747e00d03a8869c
4
+ data.tar.gz: 11d7c72374683949ad7fa09a8681620660c8f3b1f88c947e8540e857d37852b8
5
5
  SHA512:
6
- metadata.gz: 4f6b6a8405c4211c66f69071e98d53d1bb5d950d59ab3e2184b94c2cb9bf8c7de4f0a67a6b7680943d6622983f6e479f127fa7dbc0a2c86aec445fe12276d4f7
7
- data.tar.gz: 9b361ace1eb8326a7b1373ba0960b120a3e429f8e0bd9ae60bddcde6ddfdc22d49d8a9d53fbd1b05eaec3df684e2fc521c17b4c7025219ff6e4291b802de3fb4
6
+ metadata.gz: a949d16e20c45b88440608ed5da90883b11a3cba91c02282bc2ac8d740b1672c1d48223a1b955e79979ae1bf7b1253c6231058d6d4c634e62faa49f3e2b87c6d
7
+ data.tar.gz: f86a1d8590f1558ec671a2cbe382c89f89ea6f012a600c11230a0219697c75c28ba6db112050b593c4f2ba32849032bc174b4614ce28610e9f672856fb63d7df
@@ -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-darwin
6
6
  authors:
7
7
  - Stephen Margheim