activerecord-import 0.27.0 → 1.4.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.
Files changed (129) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yaml +107 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +74 -8
  5. data/Brewfile +3 -1
  6. data/CHANGELOG.md +175 -2
  7. data/Gemfile +13 -9
  8. data/LICENSE +21 -56
  9. data/README.markdown +525 -21
  10. data/Rakefile +2 -0
  11. data/activerecord-import.gemspec +6 -5
  12. data/benchmarks/benchmark.rb +7 -1
  13. data/benchmarks/lib/base.rb +2 -0
  14. data/benchmarks/lib/cli_parser.rb +3 -1
  15. data/benchmarks/lib/float.rb +2 -0
  16. data/benchmarks/lib/mysql2_benchmark.rb +2 -0
  17. data/benchmarks/lib/output_to_csv.rb +2 -0
  18. data/benchmarks/lib/output_to_html.rb +4 -2
  19. data/benchmarks/models/test_innodb.rb +2 -0
  20. data/benchmarks/models/test_memory.rb +2 -0
  21. data/benchmarks/models/test_myisam.rb +2 -0
  22. data/benchmarks/schema/{mysql_schema.rb → mysql2_schema.rb} +2 -0
  23. data/gemfiles/4.2.gemfile +2 -0
  24. data/gemfiles/5.0.gemfile +2 -0
  25. data/gemfiles/5.1.gemfile +2 -0
  26. data/gemfiles/5.2.gemfile +2 -0
  27. data/gemfiles/6.0.gemfile +4 -0
  28. data/gemfiles/6.1.gemfile +4 -0
  29. data/gemfiles/7.0.gemfile +4 -0
  30. data/lib/activerecord-import/active_record/adapters/abstract_adapter.rb +2 -0
  31. data/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb +6 -4
  32. data/lib/activerecord-import/active_record/adapters/jdbcpostgresql_adapter.rb +2 -0
  33. data/lib/activerecord-import/active_record/adapters/jdbcsqlite3_adapter.rb +2 -0
  34. data/lib/activerecord-import/active_record/adapters/mysql2_adapter.rb +2 -0
  35. data/lib/activerecord-import/active_record/adapters/postgresql_adapter.rb +2 -0
  36. data/lib/activerecord-import/active_record/adapters/seamless_database_pool_adapter.rb +2 -0
  37. data/lib/activerecord-import/active_record/adapters/sqlite3_adapter.rb +2 -0
  38. data/lib/activerecord-import/adapters/abstract_adapter.rb +9 -1
  39. data/lib/activerecord-import/adapters/em_mysql2_adapter.rb +2 -0
  40. data/lib/activerecord-import/adapters/mysql2_adapter.rb +2 -0
  41. data/lib/activerecord-import/adapters/mysql_adapter.rb +10 -11
  42. data/lib/activerecord-import/adapters/postgresql_adapter.rb +49 -38
  43. data/lib/activerecord-import/adapters/sqlite3_adapter.rb +21 -25
  44. data/lib/activerecord-import/base.rb +11 -2
  45. data/lib/activerecord-import/import.rb +180 -78
  46. data/lib/activerecord-import/mysql2.rb +2 -0
  47. data/lib/activerecord-import/postgresql.rb +2 -0
  48. data/lib/activerecord-import/sqlite3.rb +2 -0
  49. data/lib/activerecord-import/synchronize.rb +4 -2
  50. data/lib/activerecord-import/value_sets_parser.rb +4 -0
  51. data/lib/activerecord-import/version.rb +3 -1
  52. data/lib/activerecord-import.rb +3 -1
  53. data/test/adapters/jdbcmysql.rb +2 -0
  54. data/test/adapters/jdbcpostgresql.rb +2 -0
  55. data/test/adapters/jdbcsqlite3.rb +2 -0
  56. data/test/adapters/makara_postgis.rb +2 -0
  57. data/test/adapters/mysql2.rb +2 -0
  58. data/test/adapters/mysql2_makara.rb +2 -0
  59. data/test/adapters/mysql2spatial.rb +2 -0
  60. data/test/adapters/postgis.rb +2 -0
  61. data/test/adapters/postgresql.rb +2 -0
  62. data/test/adapters/postgresql_makara.rb +2 -0
  63. data/test/adapters/seamless_database_pool.rb +2 -0
  64. data/test/adapters/spatialite.rb +2 -0
  65. data/test/adapters/sqlite3.rb +2 -0
  66. data/test/{travis → github}/database.yml +3 -1
  67. data/test/import_test.rb +138 -4
  68. data/test/jdbcmysql/import_test.rb +2 -0
  69. data/test/jdbcpostgresql/import_test.rb +2 -0
  70. data/test/jdbcsqlite3/import_test.rb +2 -0
  71. data/test/makara_postgis/import_test.rb +2 -0
  72. data/test/models/account.rb +2 -0
  73. data/test/models/alarm.rb +2 -0
  74. data/test/models/animal.rb +8 -0
  75. data/test/models/bike_maker.rb +2 -0
  76. data/test/models/book.rb +2 -0
  77. data/test/models/car.rb +2 -0
  78. data/test/models/card.rb +5 -0
  79. data/test/models/chapter.rb +2 -0
  80. data/test/models/customer.rb +8 -0
  81. data/test/models/deck.rb +8 -0
  82. data/test/models/dictionary.rb +2 -0
  83. data/test/models/discount.rb +2 -0
  84. data/test/models/end_note.rb +2 -0
  85. data/test/models/group.rb +2 -0
  86. data/test/models/order.rb +8 -0
  87. data/test/models/playing_card.rb +4 -0
  88. data/test/models/promotion.rb +2 -0
  89. data/test/models/question.rb +2 -0
  90. data/test/models/rule.rb +2 -0
  91. data/test/models/tag.rb +3 -0
  92. data/test/models/tag_alias.rb +5 -0
  93. data/test/models/topic.rb +2 -0
  94. data/test/models/user.rb +2 -0
  95. data/test/models/user_token.rb +3 -0
  96. data/test/models/vendor.rb +2 -0
  97. data/test/models/widget.rb +2 -0
  98. data/test/mysql2/import_test.rb +2 -0
  99. data/test/mysql2_makara/import_test.rb +2 -0
  100. data/test/mysqlspatial2/import_test.rb +2 -0
  101. data/test/postgis/import_test.rb +2 -0
  102. data/test/postgresql/import_test.rb +2 -0
  103. data/test/schema/generic_schema.rb +33 -0
  104. data/test/schema/jdbcpostgresql_schema.rb +2 -0
  105. data/test/schema/mysql2_schema.rb +2 -0
  106. data/test/schema/postgis_schema.rb +2 -0
  107. data/test/schema/postgresql_schema.rb +18 -0
  108. data/test/schema/sqlite3_schema.rb +2 -0
  109. data/test/schema/version.rb +2 -0
  110. data/test/sqlite3/import_test.rb +2 -0
  111. data/test/support/active_support/test_case_extensions.rb +2 -0
  112. data/test/support/assertions.rb +2 -0
  113. data/test/support/factories.rb +2 -0
  114. data/test/support/generate.rb +4 -2
  115. data/test/support/mysql/import_examples.rb +2 -1
  116. data/test/support/postgresql/import_examples.rb +115 -2
  117. data/test/support/shared_examples/on_duplicate_key_ignore.rb +2 -0
  118. data/test/support/shared_examples/on_duplicate_key_update.rb +32 -0
  119. data/test/support/shared_examples/recursive_import.rb +61 -1
  120. data/test/support/sqlite3/import_examples.rb +4 -16
  121. data/test/synchronize_test.rb +2 -0
  122. data/test/test_helper.rb +27 -2
  123. data/test/value_sets_bytes_parser_test.rb +2 -0
  124. data/test/value_sets_records_parser_test.rb +2 -0
  125. metadata +29 -16
  126. data/.travis.yml +0 -71
  127. data/gemfiles/3.2.gemfile +0 -2
  128. data/gemfiles/4.0.gemfile +0 -2
  129. data/gemfiles/4.1.gemfile +0 -2
@@ -1,4 +1,5 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
+
2
3
  def should_support_postgresql_import_functionality
3
4
  should_support_recursive_import
4
5
 
@@ -37,6 +38,12 @@ def should_support_postgresql_import_functionality
37
38
  assert !topic.changed?
38
39
  end
39
40
 
41
+ if ENV['AR_VERSION'].to_f > 4.1
42
+ it "moves the dirty changes to previous_changes" do
43
+ assert topic.previous_changes.present?
44
+ end
45
+ end
46
+
40
47
  it "marks models as persisted" do
41
48
  assert !topic.new_record?
42
49
  assert topic.persisted?
@@ -96,6 +103,8 @@ def should_support_postgresql_import_functionality
96
103
  books.first.id.to_s
97
104
  end
98
105
  end
106
+ let(:true_returning_value) { ENV['AR_VERSION'].to_f >= 5.0 ? true : 't' }
107
+ let(:false_returning_value) { ENV['AR_VERSION'].to_f >= 5.0 ? false : 'f' }
99
108
 
100
109
  it "creates records" do
101
110
  assert_difference("Book.count", +1) { result }
@@ -110,6 +119,26 @@ def should_support_postgresql_import_functionality
110
119
  assert_equal [%w(King It)], result.results
111
120
  end
112
121
 
122
+ context "when given an empty array" do
123
+ let(:result) { Book.import([], returning: %w(title)) }
124
+
125
+ setup { result }
126
+
127
+ it "returns empty arrays for ids and results" do
128
+ assert_equal [], result.ids
129
+ assert_equal [], result.results
130
+ end
131
+ end
132
+
133
+ context "when a returning column is a serialized attribute" do
134
+ let(:vendor) { Vendor.new(hours: { monday: '8-5' }) }
135
+ let(:result) { Vendor.import([vendor], returning: %w(hours)) }
136
+
137
+ it "creates records" do
138
+ assert_difference("Vendor.count", +1) { result }
139
+ end
140
+ end
141
+
113
142
  context "when primary key and returning overlap" do
114
143
  let(:result) { Book.import(books, returning: %w(id title)) }
115
144
 
@@ -124,6 +153,34 @@ def should_support_postgresql_import_functionality
124
153
  end
125
154
  end
126
155
 
156
+ context "when returning is raw sql" do
157
+ let(:result) { Book.import(books, returning: "title, (xmax = '0') AS inserted") }
158
+
159
+ setup { result }
160
+
161
+ it "returns ids" do
162
+ assert_equal [book_id], result.ids
163
+ end
164
+
165
+ it "returns specified columns" do
166
+ assert_equal [['It', true_returning_value]], result.results
167
+ end
168
+ end
169
+
170
+ context "when returning contains raw sql" do
171
+ let(:result) { Book.import(books, returning: [:title, "id, (xmax = '0') AS inserted"]) }
172
+
173
+ setup { result }
174
+
175
+ it "returns ids" do
176
+ assert_equal [book_id], result.ids
177
+ end
178
+
179
+ it "returns specified columns" do
180
+ assert_equal [['It', book_id, true_returning_value]], result.results
181
+ end
182
+ end
183
+
127
184
  context "setting model attributes" do
128
185
  let(:code) { 'abc' }
129
186
  let(:discount) { 0.10 }
@@ -153,6 +210,14 @@ def should_support_postgresql_import_functionality
153
210
  assert_equal updated_promotion.discount, discount
154
211
  end
155
212
  end
213
+
214
+ context 'returning raw sql' do
215
+ let(:returning_columns) { [:discount, "(xmax = '0') AS inserted"] }
216
+
217
+ it "sets custom model attributes" do
218
+ assert_equal updated_promotion.inserted, false_returning_value
219
+ end
220
+ end
156
221
  end
157
222
  end
158
223
  end
@@ -228,10 +293,34 @@ def should_support_postgresql_import_functionality
228
293
  assert_equal({}, Vendor.first.json_data)
229
294
  end
230
295
  end
296
+
297
+ %w(json jsonb).each do |json_type|
298
+ describe "with pure #{json_type} fields" do
299
+ let(:data) { { a: :b } }
300
+ let(:json_field_name) { "pure_#{json_type}_data" }
301
+ it "imports the values from saved records" do
302
+ vendor = Vendor.create!(name: 'Vendor 1', json_field_name => data)
303
+
304
+ Vendor.import [vendor], on_duplicate_key_update: [json_field_name]
305
+ assert_equal(data.as_json, vendor.reload[json_field_name])
306
+ end
307
+ end
308
+ end
309
+ end
310
+
311
+ describe "with enum field" do
312
+ let(:vendor_type) { "retailer" }
313
+ it "imports the correct values for enum fields" do
314
+ vendor = Vendor.new(name: 'Vendor 1', vendor_type: vendor_type)
315
+ assert_difference "Vendor.count", +1 do
316
+ Vendor.import [vendor]
317
+ end
318
+ assert_equal(vendor_type, Vendor.first.vendor_type)
319
+ end
231
320
  end
232
321
 
233
322
  describe "with binary field" do
234
- let(:binary_value) { "\xE0'c\xB2\xB0\xB3Bh\\\xC2M\xB1m\\I\xC4r".force_encoding('ASCII-8BIT') }
323
+ let(:binary_value) { "\xE0'c\xB2\xB0\xB3Bh\\\xC2M\xB1m\\I\xC4r".dup.force_encoding('ASCII-8BIT') }
235
324
  it "imports the correct values for binary fields" do
236
325
  alarms = [Alarm.new(device_id: 1, alarm_type: 1, status: 1, secret_key: binary_value)]
237
326
  assert_difference "Alarm.count", +1 do
@@ -240,6 +329,30 @@ def should_support_postgresql_import_functionality
240
329
  assert_equal(binary_value, Alarm.first.secret_key)
241
330
  end
242
331
  end
332
+
333
+ unless ENV["SKIP_COMPOSITE_PK"]
334
+ describe "with composite foreign keys" do
335
+ let(:account_id) { 555 }
336
+ let(:customer) { Customer.new(account_id: account_id, name: "foo") }
337
+ let(:order) { Order.new(account_id: account_id, amount: 100, customer: customer) }
338
+
339
+ it "imports and correctly maps foreign keys" do
340
+ assert_difference "Customer.count", +1 do
341
+ Customer.import [customer]
342
+ end
343
+
344
+ assert_difference "Order.count", +1 do
345
+ Order.import [order]
346
+ end
347
+
348
+ db_customer = Customer.last
349
+ db_order = Order.last
350
+
351
+ assert_equal db_customer.orders.last, db_order
352
+ assert_not_equal db_order.customer_id, nil
353
+ end
354
+ end
355
+ end
243
356
  end
244
357
 
245
358
  def should_support_postgresql_upsert_functionality
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def should_support_on_duplicate_key_ignore
2
4
  describe "#import" do
3
5
  extend ActiveSupport::TestCase::ImportAssertions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def should_support_basic_on_duplicate_key_update
2
4
  describe "#import" do
3
5
  extend ActiveSupport::TestCase::ImportAssertions
@@ -73,6 +75,16 @@ def should_support_basic_on_duplicate_key_update
73
75
  assert_equal user.name, users[i].name + ' Rothschild'
74
76
  assert_equal 1, user.lock_version
75
77
  end
78
+ updated_values2 = User.all.map do |user|
79
+ user.name += ' jr.'
80
+ { id: user.id, name: user.name }
81
+ end
82
+ User.import(updated_values2, on_duplicate_key_update: [:name])
83
+ assert User.count == updated_values2.length
84
+ User.all.each_with_index do |user, i|
85
+ assert_equal user.name, users[i].name + ' Rothschild jr.'
86
+ assert_equal 2, user.lock_version
87
+ end
76
88
  end
77
89
 
78
90
  it 'upsert optimistic lock columns other than lock_version by model' do
@@ -246,6 +258,26 @@ def should_support_basic_on_duplicate_key_update
246
258
  end
247
259
  end
248
260
 
261
+ context "with timestamps enabled" do
262
+ let(:time) { Chronic.parse("5 minutes from now") }
263
+
264
+ it 'should not overwrite changed updated_at with current timestamp' do
265
+ topic = Topic.create(author_name: "Jane Doe", title: "Book")
266
+ timestamp = Time.now.utc
267
+ topic.updated_at = timestamp
268
+ Topic.import [topic], on_duplicate_key_update: :all, validate: false
269
+ assert_equal timestamp.to_s, Topic.last.updated_at.to_s
270
+ end
271
+
272
+ it 'should update updated_at with current timestamp' do
273
+ topic = Topic.create(author_name: "Jane Doe", title: "Book")
274
+ Timecop.freeze(time) do
275
+ Topic.import [topic], on_duplicate_key_update: [:updated_at], validate: false
276
+ assert_in_delta time.to_i, topic.reload.updated_at.to_i, 1.second
277
+ end
278
+ end
279
+ end
280
+
249
281
  context "with validation checks turned off" do
250
282
  asssertion_group(:should_support_on_duplicate_key_update) do
251
283
  should_not_update_fields_not_mentioned
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def should_support_recursive_import
2
4
  describe "importing objects with associations" do
3
5
  let(:new_topics) { Build(num_topics, :topic_with_book) }
@@ -138,6 +140,15 @@ def should_support_recursive_import
138
140
  books.each do |book|
139
141
  assert_equal book.topic_id, second_new_topic.id
140
142
  end
143
+
144
+ books.each { |book| book.topic_id = nil }
145
+ assert_no_difference "Book.count", books.size do
146
+ Book.import books, validate: false, on_duplicate_key_update: [:topic_id]
147
+ end
148
+
149
+ books.each do |book|
150
+ assert_equal book.topic_id, nil
151
+ end
141
152
  end
142
153
 
143
154
  unless ENV["SKIP_COMPOSITE_PK"]
@@ -167,7 +178,7 @@ def should_support_recursive_import
167
178
  end
168
179
  end
169
180
 
170
- # If adapter supports on_duplicate_key_update, it is only applied to top level models so that SQL with invalid
181
+ # If adapter supports on_duplicate_key_update and specific columns are specified, it is only applied to top level models so that SQL with invalid
171
182
  # columns, keys, etc isn't generated for child associations when doing recursive import
172
183
  if ActiveRecord::Base.connection.supports_on_duplicate_key_update?
173
184
  describe "on_duplicate_key_update" do
@@ -181,6 +192,55 @@ def should_support_recursive_import
181
192
  end
182
193
  end
183
194
  end
195
+
196
+ context "when :all fields are updated" do
197
+ setup do
198
+ Topic.import new_topics, recursive: true
199
+ end
200
+
201
+ it "updates associated objects" do
202
+ new_author_name = 'Richard Bachman'
203
+ topic = new_topics.first
204
+ topic.books.each do |book|
205
+ book.author_name = new_author_name
206
+ end
207
+ assert_nothing_raised do
208
+ Topic.import new_topics, recursive: true, on_duplicate_key_update: :all
209
+ end
210
+ Topic.find(topic.id).books.each do |book|
211
+ assert_equal new_author_name, book.author_name
212
+ end
213
+ end
214
+ end
215
+ end
216
+ end
217
+
218
+ # If returning option is provided, it is only applied to top level models so that SQL with invalid
219
+ # columns, keys, etc isn't generated for child associations when doing recursive import
220
+ describe "returning" do
221
+ let(:new_topics) { Build(1, :topic_with_book) }
222
+
223
+ it "imports objects with associations" do
224
+ assert_difference "Topic.count", +1 do
225
+ Topic.import new_topics, recursive: true, returning: [:content], validate: false
226
+ new_topics.each do |topic|
227
+ assert_not_nil topic.id
228
+ end
229
+ end
230
+ end
231
+ end
232
+
233
+ # If no returning option is provided, it is ignored
234
+ describe "no returning" do
235
+ let(:new_topics) { Build(1, :topic_with_book) }
236
+
237
+ it "is ignored and imports objects with associations" do
238
+ assert_difference "Topic.count", +1 do
239
+ Topic.import new_topics, recursive: true, no_returning: true, validate: false
240
+ new_topics.each do |topic|
241
+ assert_not_nil topic.id
242
+ end
243
+ end
184
244
  end
185
245
  end
186
246
  end
@@ -1,25 +1,13 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
+
2
3
  def should_support_sqlite3_import_functionality
3
4
  if ActiveRecord::Base.connection.supports_on_duplicate_key_update?
4
5
  should_support_sqlite_upsert_functionality
5
6
  end
6
7
 
7
8
  describe "#supports_imports?" do
8
- context "and SQLite is 3.7.11 or higher" do
9
- it "supports import" do
10
- version = ActiveRecord::ConnectionAdapters::SQLite3Adapter::Version.new("3.7.11")
11
- assert ActiveRecord::Base.supports_import?(version)
12
-
13
- version = ActiveRecord::ConnectionAdapters::SQLite3Adapter::Version.new("3.7.12")
14
- assert ActiveRecord::Base.supports_import?(version)
15
- end
16
- end
17
-
18
- context "and SQLite less than 3.7.11" do
19
- it "doesn't support import" do
20
- version = ActiveRecord::ConnectionAdapters::SQLite3Adapter::Version.new("3.7.10")
21
- assert !ActiveRecord::Base.supports_import?(version)
22
- end
9
+ it "should support import" do
10
+ assert ActiveRecord::Base.supports_import?
23
11
  end
24
12
  end
25
13
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../test_helper', __FILE__)
2
4
 
3
5
  describe ".synchronize" do
data/test/test_helper.rb CHANGED
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
4
+ require 'rake'
2
5
  test_dir = Pathname.new File.dirname(__FILE__)
3
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -48,8 +51,30 @@ adapter = ENV["ARE_DB"] || "sqlite3"
48
51
  FileUtils.mkdir_p 'log'
49
52
  ActiveRecord::Base.logger = Logger.new("log/test.log")
50
53
  ActiveRecord::Base.logger.level = Logger::DEBUG
51
- ActiveRecord::Base.configurations["test"] = YAML.load_file(test_dir.join("database.yml"))[adapter]
52
- ActiveRecord::Base.default_timezone = :utc
54
+
55
+ if ActiveRecord.respond_to?(:use_yaml_unsafe_load)
56
+ ActiveRecord.use_yaml_unsafe_load = true
57
+ elsif ActiveRecord::Base.respond_to?(:use_yaml_unsafe_load)
58
+ ActiveRecord::Base.use_yaml_unsafe_load = true
59
+ end
60
+
61
+ if ENV['AR_VERSION'].to_f >= 6.0
62
+ yaml_config = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.2.1')
63
+ YAML.safe_load_file(test_dir.join("database.yml"), aliases: true)[adapter]
64
+ else
65
+ YAML.load_file(test_dir.join("database.yml"))[adapter]
66
+ end
67
+ config = ActiveRecord::DatabaseConfigurations::HashConfig.new("test", adapter, yaml_config)
68
+ ActiveRecord::Base.configurations.configurations << config
69
+ else
70
+ ActiveRecord::Base.configurations["test"] = YAML.load_file(test_dir.join("database.yml"))[adapter]
71
+ end
72
+
73
+ if ActiveRecord.respond_to?(:default_timezone)
74
+ ActiveRecord.default_timezone = :utc
75
+ else
76
+ ActiveRecord::Base.default_timezone = :utc
77
+ end
53
78
 
54
79
  require "activerecord-import"
55
80
  ActiveRecord::Base.establish_connection :test
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
4
 
3
5
  require 'activerecord-import/value_sets_parser'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
4
 
3
5
  require 'activerecord-import/value_sets_parser'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2022-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -45,10 +45,10 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".github/workflows/test.yaml"
48
49
  - ".gitignore"
49
50
  - ".rubocop.yml"
50
51
  - ".rubocop_todo.yml"
51
- - ".travis.yml"
52
52
  - Brewfile
53
53
  - CHANGELOG.md
54
54
  - Gemfile
@@ -67,14 +67,14 @@ files:
67
67
  - benchmarks/models/test_innodb.rb
68
68
  - benchmarks/models/test_memory.rb
69
69
  - benchmarks/models/test_myisam.rb
70
- - benchmarks/schema/mysql_schema.rb
71
- - gemfiles/3.2.gemfile
72
- - gemfiles/4.0.gemfile
73
- - gemfiles/4.1.gemfile
70
+ - benchmarks/schema/mysql2_schema.rb
74
71
  - gemfiles/4.2.gemfile
75
72
  - gemfiles/5.0.gemfile
76
73
  - gemfiles/5.1.gemfile
77
74
  - gemfiles/5.2.gemfile
75
+ - gemfiles/6.0.gemfile
76
+ - gemfiles/6.1.gemfile
77
+ - gemfiles/7.0.gemfile
78
78
  - lib/activerecord-import.rb
79
79
  - lib/activerecord-import/active_record/adapters/abstract_adapter.rb
80
80
  - lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb
@@ -112,6 +112,7 @@ files:
112
112
  - test/adapters/spatialite.rb
113
113
  - test/adapters/sqlite3.rb
114
114
  - test/database.yml.sample
115
+ - test/github/database.yml
115
116
  - test/import_test.rb
116
117
  - test/jdbcmysql/import_test.rb
117
118
  - test/jdbcpostgresql/import_test.rb
@@ -119,18 +120,25 @@ files:
119
120
  - test/makara_postgis/import_test.rb
120
121
  - test/models/account.rb
121
122
  - test/models/alarm.rb
123
+ - test/models/animal.rb
122
124
  - test/models/bike_maker.rb
123
125
  - test/models/book.rb
124
126
  - test/models/car.rb
127
+ - test/models/card.rb
125
128
  - test/models/chapter.rb
129
+ - test/models/customer.rb
130
+ - test/models/deck.rb
126
131
  - test/models/dictionary.rb
127
132
  - test/models/discount.rb
128
133
  - test/models/end_note.rb
129
134
  - test/models/group.rb
135
+ - test/models/order.rb
136
+ - test/models/playing_card.rb
130
137
  - test/models/promotion.rb
131
138
  - test/models/question.rb
132
139
  - test/models/rule.rb
133
140
  - test/models/tag.rb
141
+ - test/models/tag_alias.rb
134
142
  - test/models/topic.rb
135
143
  - test/models/user.rb
136
144
  - test/models/user_token.rb
@@ -161,12 +169,11 @@ files:
161
169
  - test/support/sqlite3/import_examples.rb
162
170
  - test/synchronize_test.rb
163
171
  - test/test_helper.rb
164
- - test/travis/database.yml
165
172
  - test/value_sets_bytes_parser_test.rb
166
173
  - test/value_sets_records_parser_test.rb
167
- homepage: http://github.com/zdennis/activerecord-import
174
+ homepage: https://github.com/zdennis/activerecord-import
168
175
  licenses:
169
- - Ruby
176
+ - MIT
170
177
  metadata: {}
171
178
  post_install_message:
172
179
  rdoc_options: []
@@ -176,15 +183,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
183
  requirements:
177
184
  - - ">="
178
185
  - !ruby/object:Gem::Version
179
- version: 1.9.2
186
+ version: 2.4.0
180
187
  required_rubygems_version: !ruby/object:Gem::Requirement
181
188
  requirements:
182
189
  - - ">="
183
190
  - !ruby/object:Gem::Version
184
191
  version: '0'
185
192
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.6.11
193
+ rubygems_version: 3.0.3.1
188
194
  signing_key:
189
195
  specification_version: 4
190
196
  summary: Bulk insert extension for ActiveRecord
@@ -203,6 +209,7 @@ test_files:
203
209
  - test/adapters/spatialite.rb
204
210
  - test/adapters/sqlite3.rb
205
211
  - test/database.yml.sample
212
+ - test/github/database.yml
206
213
  - test/import_test.rb
207
214
  - test/jdbcmysql/import_test.rb
208
215
  - test/jdbcpostgresql/import_test.rb
@@ -210,18 +217,25 @@ test_files:
210
217
  - test/makara_postgis/import_test.rb
211
218
  - test/models/account.rb
212
219
  - test/models/alarm.rb
220
+ - test/models/animal.rb
213
221
  - test/models/bike_maker.rb
214
222
  - test/models/book.rb
215
223
  - test/models/car.rb
224
+ - test/models/card.rb
216
225
  - test/models/chapter.rb
226
+ - test/models/customer.rb
227
+ - test/models/deck.rb
217
228
  - test/models/dictionary.rb
218
229
  - test/models/discount.rb
219
230
  - test/models/end_note.rb
220
231
  - test/models/group.rb
232
+ - test/models/order.rb
233
+ - test/models/playing_card.rb
221
234
  - test/models/promotion.rb
222
235
  - test/models/question.rb
223
236
  - test/models/rule.rb
224
237
  - test/models/tag.rb
238
+ - test/models/tag_alias.rb
225
239
  - test/models/topic.rb
226
240
  - test/models/user.rb
227
241
  - test/models/user_token.rb
@@ -252,6 +266,5 @@ test_files:
252
266
  - test/support/sqlite3/import_examples.rb
253
267
  - test/synchronize_test.rb
254
268
  - test/test_helper.rb
255
- - test/travis/database.yml
256
269
  - test/value_sets_bytes_parser_test.rb
257
270
  - test/value_sets_records_parser_test.rb
data/.travis.yml DELETED
@@ -1,71 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.3.7
5
-
6
- env:
7
- global:
8
- # https://github.com/discourse/discourse/blob/master/.travis.yml
9
- - RUBY_GC_MALLOC_LIMIT=50000000
10
- matrix:
11
- - AR_VERSION=3.2
12
- - AR_VERSION=4.0
13
- - AR_VERSION=4.1
14
- - AR_VERSION=4.2
15
- - AR_VERSION=5.0
16
- - AR_VERSION=5.1
17
- - AR_VERSION=5.2
18
-
19
- matrix:
20
- include:
21
- - rvm: jruby-9.1.14.0
22
- env: AR_VERSION=4.2
23
-
24
- script:
25
- - bundle exec rake test:jdbcsqlite3
26
- - bundle exec rake test:jdbcmysql
27
- - bundle exec rake test:jdbcpostgresql
28
-
29
- fast_finish: true
30
-
31
- addons:
32
- postgresql: "9.5"
33
- apt:
34
- sources:
35
- - travis-ci/sqlite3
36
- - mysql-5.7-trusty
37
- packages:
38
- - sqlite3
39
- - mysql-server
40
- - mysql-client
41
- - postgresql-9.5-postgis-2.3
42
-
43
- before_install:
44
- - gem update --system
45
- - sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
46
- - sudo mysql_upgrade
47
- - sudo service mysql restart
48
-
49
- before_script:
50
- - mysql -e 'create database activerecord_import_test;'
51
- - psql -c 'create database activerecord_import_test;' -U postgres
52
- - psql activerecord_import_test -c 'create extension if not exists hstore;' -U postgres
53
- - psql -c 'create extension if not exists postgis;' -U postgres
54
- - psql -c 'create extension if not exists "uuid-ossp";' -U postgres
55
- - cp test/travis/database.yml test/database.yml
56
-
57
- script:
58
- - bundle exec rake test:mysql2
59
- - bundle exec rake test:mysql2_makara
60
- - bundle exec rake test:mysql2spatial
61
- - bundle exec rake test:postgis
62
- - bundle exec rake test:postgresql
63
- - bundle exec rake test:postgresql_makara
64
- - bundle exec rake test:seamless_database_pool
65
- - bundle exec rake test:spatialite
66
- - bundle exec rake test:sqlite3
67
- - bundle exec rubocop
68
-
69
- dist: trusty
70
-
71
- sudo: required
data/gemfiles/3.2.gemfile DELETED
@@ -1,2 +0,0 @@
1
- gem 'activerecord', '~> 3.2.0'
2
- gem 'composite_primary_keys', '~> 5.0'
data/gemfiles/4.0.gemfile DELETED
@@ -1,2 +0,0 @@
1
- gem 'activerecord', '~> 4.0.0'
2
- gem 'composite_primary_keys', '~> 6.0'
data/gemfiles/4.1.gemfile DELETED
@@ -1,2 +0,0 @@
1
- gem 'activerecord', '~> 4.1.0'
2
- gem 'composite_primary_keys', '~> 7.0'