tapsoob 0.5.28 → 0.5.29

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: 488bc024b3e68fc52750a34073f6e1fd7544787d3e5d8f9994a31de6e7fa8dc7
4
- data.tar.gz: 95f66bd12f95fa6ace15b95a0a8373a3b2665197fe383f1f3588f37f3ba41a6e
3
+ metadata.gz: 748c9cf97135cae0c72f0ba298f7c3f197e65764ce4c44c0670d8ef2fe5181ed
4
+ data.tar.gz: 7bebc431915dcf8dd5bff0ee341cf22765646d1854485c23f80b5b9c642fc142
5
5
  SHA512:
6
- metadata.gz: 90df45cbd8c7da3efda26ce50ce0216c14d45d61b86ea6d20531d4c17f61bf954cd0e07b1211fbbf00134e422e67220e21a4f7195926d9d2a9746e65beb104b6
7
- data.tar.gz: 5d5754a77f0e7c85e4e8d347764a94ae1c365cc432d3a98a727dc53c5d0023ea861b4ae7fa1bfe2c7579a27f9de77780c245f01ddd84a92aef6bfdcd21145509
6
+ metadata.gz: 404478581e61ebdd2875c21d0af865acd5e9dba010292819046cd5e195c9c78cad675bdd50216ea26c5bba8923c0e532a8bd2593b4fe7eb0e71f85db865ef067
7
+ data.tar.gz: 3310489ebd6dcfd7efc76c4fd5d9b2ec6ffa9da12c6cb4161ffd02267f376927b957f5142dcf42ba81fd544c470c36e07f7e0263b66bcae6168b6c9dfe309b61
@@ -436,7 +436,9 @@ module Tapsoob
436
436
  log.info "#{tables.size} tables, #{format_number(record_count)} records"
437
437
 
438
438
  tables.each do |table_name, count|
439
- next unless File.exist?(File.join(dump_path, "data", "#{table_name}.json")) || File.exist?(File.join(dump_path, "data", "#{table_name}.json")) && JSON.parse(File.read(File.join(dump_path, "data", "#{table_name}.json")))["data"].size == 0
439
+ # Skip if data file doesn't exist or has no data
440
+ data_file = File.join(dump_path, "data", "#{table_name}.json")
441
+ next unless File.exist?(data_file) && count > 0
440
442
  db[table_name.to_sym].truncate if @opts[:purge]
441
443
  stream = Tapsoob::DataStream.factory(db, {
442
444
  :table_name => table_name,
@@ -532,8 +534,13 @@ module Tapsoob
532
534
  tbls = Dir.glob(File.join(dump_path, "schemas", "*")).map { |path| File.basename(path, ".rb") }
533
535
  tbls.each do |table|
534
536
  if File.exist?(File.join(dump_path, "data", "#{table}.json"))
535
- data = JSON.parse(File.read(File.join(dump_path, "data", "#{table}.json")))
536
- tables_with_counts[table] = data["data"].size
537
+ # Read NDJSON format - each line is a separate JSON chunk
538
+ total_rows = 0
539
+ File.readlines(File.join(dump_path, "data", "#{table}.json")).each do |line|
540
+ chunk = JSON.parse(line.strip)
541
+ total_rows += chunk["data"].size if chunk["data"]
542
+ end
543
+ tables_with_counts[table] = total_rows
537
544
  else
538
545
  tables_with_counts[table] = 0
539
546
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.5.28".freeze
3
+ VERSION = "0.5.29".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.5.28
4
+ version: 0.5.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger