seed_dump 3.3.1 → 3.4.0

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.
@@ -0,0 +1,163 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ seed_dump (3.3.1)
5
+ activerecord (>= 4)
6
+ activesupport (>= 4)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (8.0.2)
12
+ activesupport (= 8.0.2)
13
+ activerecord (8.0.2)
14
+ activemodel (= 8.0.2)
15
+ activesupport (= 8.0.2)
16
+ timeout (>= 0.4.0)
17
+ activerecord-import (0.28.2)
18
+ activerecord (>= 3.2)
19
+ activesupport (8.0.2)
20
+ base64
21
+ benchmark (>= 0.3)
22
+ bigdecimal
23
+ concurrent-ruby (~> 1.0, >= 1.3.1)
24
+ connection_pool (>= 2.2.5)
25
+ drb
26
+ i18n (>= 1.6, < 2)
27
+ logger (>= 1.4.2)
28
+ minitest (>= 5.1)
29
+ securerandom (>= 0.3)
30
+ tzinfo (~> 2.0, >= 2.0.5)
31
+ uri (>= 0.13.1)
32
+ addressable (2.4.0)
33
+ appraisal (2.5.0)
34
+ bundler
35
+ rake
36
+ thor (>= 0.14.0)
37
+ base64 (0.2.0)
38
+ benchmark (0.4.0)
39
+ bigdecimal (3.1.9)
40
+ builder (3.3.0)
41
+ byebug (11.1.3)
42
+ concurrent-ruby (1.3.5)
43
+ connection_pool (2.5.2)
44
+ database_cleaner-active_record (2.2.0)
45
+ activerecord (>= 5.a)
46
+ database_cleaner-core (~> 2.0.0)
47
+ database_cleaner-core (2.0.1)
48
+ date (3.4.1)
49
+ descendants_tracker (0.0.4)
50
+ thread_safe (~> 0.3, >= 0.3.1)
51
+ diff-lcs (1.6.1)
52
+ drb (2.2.1)
53
+ factory_bot (6.5.1)
54
+ activesupport (>= 6.1.0)
55
+ faraday (0.9.2)
56
+ multipart-post (>= 1.2, < 3)
57
+ git (1.11.0)
58
+ rchardet (~> 1.8)
59
+ github_api (0.16.0)
60
+ addressable (~> 2.4.0)
61
+ descendants_tracker (~> 0.0.4)
62
+ faraday (~> 0.8, < 0.10)
63
+ hashie (>= 3.4)
64
+ mime-types (>= 1.16, < 3.0)
65
+ oauth2 (~> 1.0)
66
+ hashie (5.0.0)
67
+ highline (3.1.2)
68
+ reline
69
+ i18n (1.14.7)
70
+ concurrent-ruby (~> 1.0)
71
+ io-console (0.8.0)
72
+ jeweler (2.3.9)
73
+ builder
74
+ bundler
75
+ git (>= 1.2.5)
76
+ github_api (~> 0.16.0)
77
+ highline (>= 1.6.15)
78
+ nokogiri (>= 1.5.10)
79
+ psych
80
+ rake
81
+ rdoc
82
+ semver2
83
+ jwt (2.10.1)
84
+ base64
85
+ logger (1.7.0)
86
+ mime-types (2.99.3)
87
+ mini_portile2 (2.8.8)
88
+ minitest (5.25.5)
89
+ multi_json (1.15.0)
90
+ multi_xml (0.7.1)
91
+ bigdecimal (~> 3.1)
92
+ multipart-post (2.4.1)
93
+ mutex_m (0.3.0)
94
+ nokogiri (1.18.8)
95
+ mini_portile2 (~> 2.8.2)
96
+ racc (~> 1.4)
97
+ nokogiri (1.18.8-arm64-darwin)
98
+ racc (~> 1.4)
99
+ oauth2 (1.4.8)
100
+ faraday (>= 0.8, < 3.0)
101
+ jwt (>= 1.0, < 3.0)
102
+ multi_json (~> 1.3)
103
+ multi_xml (~> 0.5)
104
+ rack (>= 1.2, < 3)
105
+ psych (5.2.3)
106
+ date
107
+ stringio
108
+ racc (1.8.1)
109
+ rack (2.2.13)
110
+ rake (13.2.1)
111
+ rchardet (1.9.0)
112
+ rdoc (6.13.1)
113
+ psych (>= 4.0.0)
114
+ reline (0.6.1)
115
+ io-console (~> 0.5)
116
+ rspec (3.13.2)
117
+ rspec-core (~> 3.13.0)
118
+ rspec-expectations (~> 3.13.0)
119
+ rspec-mocks (~> 3.13.0)
120
+ rspec-core (3.13.6)
121
+ rspec-support (~> 3.13.0)
122
+ rspec-expectations (3.13.5)
123
+ diff-lcs (>= 1.2.0, < 2.0)
124
+ rspec-support (~> 3.13.0)
125
+ rspec-mocks (3.13.7)
126
+ diff-lcs (>= 1.2.0, < 2.0)
127
+ rspec-support (~> 3.13.0)
128
+ rspec-support (3.13.6)
129
+ securerandom (0.4.1)
130
+ semver2 (3.4.2)
131
+ sqlite3 (2.6.0)
132
+ mini_portile2 (~> 2.8.0)
133
+ sqlite3 (2.6.0-arm64-darwin)
134
+ stringio (3.1.7)
135
+ thor (1.3.2)
136
+ thread_safe (0.3.6)
137
+ timeout (0.4.3)
138
+ tzinfo (2.0.6)
139
+ concurrent-ruby (~> 1.0)
140
+ uri (1.0.3)
141
+
142
+ PLATFORMS
143
+ arm64-darwin-24
144
+ ruby
145
+
146
+ DEPENDENCIES
147
+ activerecord (>= 8.0.0.alpha, < 8.1)
148
+ activerecord-import (~> 0.28)
149
+ activesupport (>= 8.0.0.alpha, < 8.1)
150
+ appraisal (~> 2.4)
151
+ benchmark
152
+ byebug (~> 11.1)
153
+ database_cleaner-active_record (~> 2.0)
154
+ factory_bot (~> 6.1)
155
+ jeweler (~> 2.3)
156
+ logger
157
+ mutex_m
158
+ rspec (~> 3.13.0)
159
+ seed_dump!
160
+ sqlite3 (>= 2.1)
161
+
162
+ BUNDLED WITH
163
+ 2.6.2
@@ -3,9 +3,11 @@ class SeedDump
3
3
  module Enumeration
4
4
  def active_record_enumeration(records, io, options)
5
5
  # If the records don't already have an order,
6
- # order them by primary key ascending.
6
+ # order them by primary key ascending (if the table has a primary key).
7
7
  if !records.respond_to?(:arel) || records.arel.orders.blank?
8
- records.order("#{records.quoted_table_name}.#{records.quoted_primary_key} ASC")
8
+ if records.primary_key.present?
9
+ records = records.order(records.primary_key => :asc)
10
+ end
9
11
  end
10
12
 
11
13
  num_of_batches, batch_size, last_batch_size = batch_params_from(records, options)
@@ -56,7 +58,13 @@ class SeedDump
56
58
  def batch_params_from(records, options)
57
59
  batch_size = batch_size_from(records, options)
58
60
 
59
- count = records.count
61
+ # Use unscope(:select) to avoid issues with default_scope that selects
62
+ # specific columns, which would cause COUNT(col1, col2, ...) errors
63
+ count = if records.respond_to?(:unscope)
64
+ records.unscope(:select).count
65
+ else
66
+ records.count
67
+ end
60
68
 
61
69
  remainder = count % batch_size
62
70