tapsoob 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c0f4afc6bec8cd7400fd9d0d35312e073de3993ce7b3a87976fc0a83ae51462
4
- data.tar.gz: 1b83f0364ae8528003f6616a5ab84811c6493b15ea255b0276a8b42ae0ceb874
3
+ metadata.gz: d5483bf6fead82a0cc2b5392b841abbf19b5bbb99d9a1137f817ede99a1012e3
4
+ data.tar.gz: 0f33862c44439dffe48680e25fe0dbbdcba6a1efc0846dd961049a91512dca30
5
5
  SHA512:
6
- metadata.gz: f10b6962cf139a3354fe01910ec5a2925125c07f745da41ad093f03c4fff49751a3b634b39e8e7e3b1ed8f5f09dd0d64392a4312e3746d87a9d9e72f1e2fbd48
7
- data.tar.gz: cc434994466836b9089ce3651a1ad9e092b2ef879663bb03fb49c1712052a408f4b727efaba122d5a011856a29fd08a709703f5c174cf180166dd026f38f1b89
6
+ metadata.gz: 750cc687fcc1f63f11c4e1b27c7701c5e00e40bc351dac3245df6fd428abadb91f601633b6e37780a6d83311787b7bae91713004528bbe4500e1cbefcb157c5c
7
+ data.tar.gz: 1f5224ae3b8b5bdbd4df9f164932632db9201ec656639c90ba2b6519b5483d62fd66ebd3d87a0847e1e7b2b5bff647608118494e5b07da44d43a68a211ebbaec
@@ -56,7 +56,10 @@ module Tapsoob
56
56
  filtered_idxs.each do |table, indexes|
57
57
  progress = opts[:progress] ? Tapsoob::Progress::Bar.new("#{table} indexes", indexes.size, STDOUT, max_title_width) : nil
58
58
  indexes.each do |idx|
59
- Tapsoob::Utils.load_indexes(database_url, idx)
59
+ # Handle both string format (correct) and array format (from older buggy version)
60
+ # idx should be a migration string, but may have been incorrectly stored as [string]
61
+ migration_string = idx.is_a?(Array) ? idx.first : idx
62
+ Tapsoob::Utils.load_indexes(database_url, migration_string)
60
63
  progress.inc(1) if progress
61
64
  end
62
65
  progress.finish if progress
data/lib/tapsoob/utils.rb CHANGED
@@ -98,8 +98,6 @@ Data : #{data}
98
98
  # this is not true for other databases so we must check if the field is
99
99
  # actually text and manually convert it back to a string
100
100
  def incorrect_blobs(db, table)
101
- return [] if (db.url =~ /(mysql|mysql2):\/\//).nil?
102
-
103
101
  columns = []
104
102
  db.schema(table).each do |data|
105
103
  column, cdata = data
@@ -109,10 +107,23 @@ Data : #{data}
109
107
  end
110
108
 
111
109
  def encode_blobs(row, columns)
112
- return row if columns.size == 0
110
+ # Encode columns known to be blobs
113
111
  columns.each do |c|
114
- row[c] = base64encode(row[c]) unless row[c].nil?
112
+ if row[c].is_a?(Sequel::SQL::Blob)
113
+ row[c] = base64encode(row[c]) unless row[c].nil?
114
+ elsif !row[c].nil? && row[c].encoding == Encoding::ASCII_8BIT
115
+ # Handle binary data that might not be wrapped in Sequel::SQL::Blob
116
+ row[c] = base64encode(row[c])
117
+ end
118
+ end unless columns.size == 0
119
+
120
+ # Also check all values for Sequel::SQL::Blob objects that might not be in the columns list
121
+ row.each do |key, value|
122
+ if value.is_a?(Sequel::SQL::Blob) && !columns.include?(key)
123
+ row[key] = base64encode(value)
124
+ end
115
125
  end
126
+
116
127
  row
117
128
  end
118
129
 
@@ -144,9 +155,11 @@ Data : #{data}
144
155
 
145
156
  def export_indexes(dump_path, table, index_data)
146
157
  # Use append-only writes to avoid O(n²) complexity
158
+ # Each index_data is a migration string that should be stored as NDJSON
147
159
  index_file = File.join(dump_path, "indexes", "#{table}.json")
148
160
 
149
161
  File.open(index_file, 'a') do |file|
162
+ # Store as NDJSON - each line is a JSON-encoded migration string
150
163
  file.write(JSON.generate(index_data) + "\n")
151
164
  end
152
165
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.7.1".freeze
3
+ VERSION = "0.7.3".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapsoob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger