real_data_tests 0.5.0 → 0.5.1

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: 76313adb8becf99110aade7dae2741bb9fbb18426eab847ec46791dff93acec4
4
- data.tar.gz: 2650573c1d3a7dc0d3e3866d0520c27696d4fe7d858b5d3b6380b3c88f640bd3
3
+ metadata.gz: f5d06a256556a9b9cc4fa512260be0381b38ed0c221306034d7b58704d708f7c
4
+ data.tar.gz: 981f35fb5a69f1c3279d91a8310dd51eebd859b9ea1e6d603fa9a6386aa8da2f
5
5
  SHA512:
6
- metadata.gz: 6ef108ecbc7c30db555e8fb8792a08fce6af245763f524f0d6c1d8fe1bb59cff69d63e902eb46a785f8122fab502abb0dfd0803747348183f031cacdd6080ad0
7
- data.tar.gz: 900f6e4f32dfbabae2a5492d7cc78bb8490f33b5b7610c9acd1b735e61e2837101ca0b7b8b74cd849d1cbc857805556935b821a87c56e7efa3005962a3179550
6
+ metadata.gz: 1e7c0798590208da4c836b0087f7110fad2b74cc50772497a290d0208ada37aecf37794af2d5348daba99cf14606bc4837ddee6433de0aa25cfe8d0fe8b26545
7
+ data.tar.gz: 265fc7134bab58a95386301be7e1b873ead228a13ebfbb014607408ba6d97b06b3ac524d7abee7af92a80a9dc7064ef27c593f34f4fe5e88f8209ada6a19e647
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## [Unreleased]
1
+ ## [0.5.1] - 2026-09-16
2
+ ### Fixed
3
+ - `PgDumpGenerator` now quotes table and column names in generated `INSERT` statements
4
+ - Previously identifiers were written unquoted, so a reserved-word column (e.g. `default`, `order`, `user`) produced `PG::SyntaxError` on load, and mixed-case table names failed to resolve
5
+ - Identifiers are quoted with the connection's `quote_table_name` / `quote_column_name`; dumps generated before this fix load unchanged
6
+
7
+ ## [0.5.0] - 2026-07-28
2
8
  ### Added
3
9
  - **Load strategies**: SQL dump loading is now pluggable via `RealDataTests::LoadStrategies`
4
10
  - `LoadStrategies::Native` — loads on the ActiveRecord connection (default only via `load_real_test_data_native`)
@@ -110,4 +116,4 @@
110
116
  - Updated documentation with preset usage examples and best practices
111
117
 
112
118
  ## [0.1.0] - 2025-01-11
113
- - Initial release
119
+ - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- real_data_tests (0.5.0)
4
+ real_data_tests (0.5.1)
5
5
  activerecord (>= 5.0)
6
6
  csv
7
7
  faker (~> 3.0)
@@ -104,9 +104,14 @@ module RealDataTests
104
104
  end
105
105
 
106
106
  def collect_inserts(records)
107
+ connection = ActiveRecord::Base.connection
108
+
107
109
  records.map do |record|
108
- table_name = record.class.table_name
110
+ # Quote identifiers so reserved words (e.g. a "default" column) and
111
+ # mixed-case names survive the round-trip through the loader.
112
+ quoted_table_name = connection.quote_table_name(record.class.table_name)
109
113
  columns = record.class.column_names
114
+ quoted_columns = columns.map { |column| connection.quote_column_name(column) }
110
115
 
111
116
  values = columns.map do |column|
112
117
  if record.class.respond_to?(:defined_enums) && record.class.defined_enums.key?(column)
@@ -118,8 +123,8 @@ module RealDataTests
118
123
  end
119
124
 
120
125
  <<~SQL.strip
121
- INSERT INTO #{table_name}
122
- (#{columns.join(', ')})
126
+ INSERT INTO #{quoted_table_name}
127
+ (#{quoted_columns.join(', ')})
123
128
  VALUES (#{values.join(', ')})
124
129
  ON CONFLICT (id) DO NOTHING;
125
130
  SQL
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RealDataTests
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real_data_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Dias
@@ -178,7 +178,6 @@ files:
178
178
  - lib/real_data_tests/sql_dump_parser.rb
179
179
  - lib/real_data_tests/test_data_builder.rb
180
180
  - lib/real_data_tests/version.rb
181
- - real_data_tests.gemspec
182
181
  homepage: https://github.com/diasks2/real_data_tests
183
182
  licenses:
184
183
  - MIT
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/real_data_tests/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "real_data_tests"
7
- spec.version = RealDataTests::VERSION
8
- spec.authors = ["Kevin Dias"]
9
- spec.email = ["diasks2@gmail.com"]
10
-
11
- spec.summary = "Create realistic test data from local db records"
12
- spec.description = "A Ruby gem that helps create test data by analyzing and extracting real records and their associations from your database."
13
- spec.homepage = "https://github.com/diasks2/real_data_tests"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
16
-
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = spec.homepage
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(__dir__) do
24
- `git ls-files -z`.split("\x0").reject do |f|
25
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
- end
27
- end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
31
-
32
- spec.add_dependency "rails", ">= 5.0"
33
- spec.add_dependency "activerecord", ">= 5.0"
34
- spec.add_dependency "thor", "~> 1.0"
35
- spec.add_dependency "pg", ">= 1.1"
36
- spec.add_dependency "csv"
37
- spec.add_development_dependency "rake", "~> 13.0"
38
- spec.add_development_dependency "rspec", "~> 3.0"
39
- spec.add_development_dependency "database_cleaner", "~> 2.0"
40
- spec.add_development_dependency "database_cleaner-active_record"
41
- spec.add_dependency "faker", "~> 3.0"
42
- end