activerecord-import 2.0.0 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f55c9faf85e948fbeb480ebca5baeca11b2275a626bc6ba7517e9d3e8c37e9e7
4
- data.tar.gz: 80b267b08ef3a10bb91b029401e8fb6b49fdfcadeeb29a2e5e18fd6c8f529192
3
+ metadata.gz: f7cd19fa557186daf34db96db71f26a7db70b15e66a0a42eaab33be304945ab0
4
+ data.tar.gz: ff8afe763d437210ea1c78e21bacd0b4ae84f113fbadbda087077bf402f08e64
5
5
  SHA512:
6
- metadata.gz: f838da07331afe7827ad7d4f323ebf3f2191decd59a82359393f20eee866345258abb979875dd1c9b853533099797cdf7599ded20ca4e07997f8bce491f4c03e
7
- data.tar.gz: 5a257bacb43492f25a65ecc382fe8ad126c4dac474eae7ee2beb3ba92c2cb95e64070a40cd20c48e47f46b51e64b69c2addd76a15fed75863df2ecb4a0fbdb70
6
+ metadata.gz: 402d2087c8c35a2adfa3787ee4e183883df74cc1f4ad2276de1227ba9778b630bfbee546faa3b53b7dcbe1142232bd7d03de046ccab5c6caa5c475a3bc4f15c1
7
+ data.tar.gz: ef5ce7d4dba744b3c58a0affbe326b50d764c7e4c4726b468ad4d18eacee13fbaa8d7b5d78459bc048e8eeb0628cf34b52a59f759f0a1f4d9d491b7439d5845a
@@ -125,11 +125,14 @@ jobs:
125
125
  bundle exec rake test:mysql2
126
126
  bundle exec rake test:mysql2_makara
127
127
  bundle exec rake test:mysql2spatial
128
+ bundle exec rake test:mysql2_proxy
129
+ bundle exec rake test:janus_mysql2
128
130
  - name: Run tests with postgresql
129
131
  run: |
130
132
  bundle exec rake test:postgis
131
133
  bundle exec rake test:postgresql
132
134
  bundle exec rake test:postgresql_makara
135
+ bundle exec rake test:postgresql_proxy
133
136
  - name: Run tests with seamless_database_pool
134
137
  run: |
135
138
  bundle exec rake test:seamless_database_pool
@@ -140,7 +143,10 @@ jobs:
140
143
  bundle exec rake test:sqlite3
141
144
  - name: Run trilogy tests
142
145
  if: ${{ matrix.env.AR_VERSION >= '7.0' && !startsWith(matrix.ruby, 'jruby') }}
143
- run: bundle exec rake test:trilogy
146
+ run: |
147
+ bundle exec rake test:trilogy
148
+ bundle exec rake test:janus_trilogy
149
+
144
150
  lint:
145
151
  runs-on: ubuntu-latest
146
152
  env:
data/.rubocop.yml CHANGED
@@ -15,9 +15,6 @@ Metrics/ClassLength:
15
15
  Metrics/CyclomaticComplexity:
16
16
  Enabled: false
17
17
 
18
- Metrics/LineLength:
19
- Enabled: false
20
-
21
18
  Metrics/MethodLength:
22
19
  Enabled: false
23
20
 
@@ -93,6 +90,9 @@ Layout/SpaceInsideParens:
93
90
  Layout/SpaceInsidePercentLiteralDelimiters:
94
91
  Enabled: false
95
92
 
93
+ Layout/LineLength:
94
+ Enabled: false
95
+
96
96
  Lint/ErbNewArguments:
97
97
  Enabled: false
98
98
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## Changes in 2.2.0
2
+
3
+ ### New Features
4
+
5
+ * Add Support for Janus ActiveRecord adapters. Thanks to @permidon via #\873.
6
+
7
+ ## Changes in 2.1.0
8
+
9
+ ### New Features
10
+
11
+ * Add Support for `active_record_proxy_adapters` gem thanks to @stingrayzboy via #\867.
12
+ Since Rails 7.1 makara no longer works and it is not currently maintained. The @nasdaq team
13
+ have written a gem called [active_record_proxy_adapters](https://rubygems.org/gems/active_record_proxy_adapters)
14
+ that implements some makara functionality.
15
+
1
16
  ## Changes in 2.0.0
2
17
 
3
18
  ### Breaking Changes
data/Rakefile CHANGED
@@ -19,17 +19,21 @@ ADAPTERS = %w(
19
19
  mysql2
20
20
  mysql2_makara
21
21
  mysql2spatial
22
+ mysql2_proxy
23
+ janus_mysql2
22
24
  jdbcmysql
23
25
  jdbcsqlite3
24
26
  jdbcpostgresql
25
27
  postgresql
26
28
  postgresql_makara
29
+ postgresql_proxy
27
30
  postgis
28
31
  makara_postgis
29
32
  sqlite3
30
33
  spatialite
31
34
  seamless_database_pool
32
35
  trilogy
36
+ janus_trilogy
33
37
  ).freeze
34
38
  ADAPTERS.each do |adapter|
35
39
  namespace :test do
@@ -58,7 +58,7 @@ module ActiveRecord::Import::SQLite3Adapter
58
58
  sql = []
59
59
 
60
60
  # Options :recursive and :on_duplicate_key_ignore are mutually exclusive
61
- if supports_on_duplicate_key_update? && ((options[:ignore] || options[:on_duplicate_key_ignore]) && !options[:on_duplicate_key_update])
61
+ if supports_on_duplicate_key_update? && (options[:ignore] || options[:on_duplicate_key_ignore]) && !options[:on_duplicate_key_update]
62
62
  sql << sql_for_on_duplicate_key_ignore( options[:on_duplicate_key_ignore] )
63
63
  end
64
64
 
@@ -11,11 +11,15 @@ module ActiveRecord::Import
11
11
  case adapter
12
12
  when 'mysql2_makara' then 'mysql2'
13
13
  when 'mysql2spatial' then 'mysql2'
14
+ when 'mysql2_proxy' then 'mysql2'
15
+ when 'janus_mysql2' then 'mysql2'
14
16
  when 'spatialite' then 'sqlite3'
15
17
  when 'postgresql_makara' then 'postgresql'
18
+ when 'postgresql_proxy' then 'postgresql'
16
19
  when 'makara_postgis' then 'postgresql'
17
20
  when 'postgis' then 'postgresql'
18
21
  when 'cockroachdb' then 'postgresql'
22
+ when 'janus_trilogy' then 'trilogy'
19
23
  else adapter
20
24
  end
21
25
  end
@@ -559,7 +559,7 @@ class ActiveRecord::Base
559
559
  options[:primary_key] = primary_key
560
560
  options[:locking_column] = locking_column if locking_enabled?
561
561
 
562
- is_validating = options[:validate_with_context].present? ? true : options[:validate]
562
+ is_validating = options[:validate_with_context].present? || options[:validate]
563
563
  validator = ActiveRecord::Import::Validator.new(self, options)
564
564
 
565
565
  # assume array of model objects
@@ -1132,8 +1132,6 @@ When importing an array of hashes with provided columns_names, each hash must co
1132
1132
 
1133
1133
  Required keys: #{required_keys}
1134
1134
  Missing keys: #{missing_keys}
1135
-
1136
- Hash: #{hash}
1137
1135
  EOS
1138
1136
  else
1139
1137
  <<-EOS
@@ -1146,8 +1144,6 @@ for the missing keys or group these records into batches by key set before impor
1146
1144
  Required keys: #{required_keys}
1147
1145
  Extra keys: #{extra_keys}
1148
1146
  Missing keys: #{missing_keys}
1149
-
1150
- Hash: #{hash}
1151
1147
  EOS
1152
1148
  end
1153
1149
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Import
5
- VERSION = "2.0.0"
5
+ VERSION = "2.2.0"
6
6
  end
7
7
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV["ARE_DB"] = "mysql2"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'logger'
4
+
5
+ ENV["ARE_DB"] = "trilogy"
6
+
7
+ if ENV['AR_VERSION'].to_f <= 7.0
8
+ require "activerecord-trilogy-adapter"
9
+ require "trilogy_adapter/connection"
10
+ ActiveRecord::Base.extend TrilogyAdapter::Connection
11
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV["ARE_DB"] = "mysql2"
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV["ARE_DB"] = "postgresql"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'logger'
4
+
3
5
  ENV["ARE_DB"] = "trilogy"
4
6
 
5
7
  if ENV['AR_VERSION'].to_f <= 7.0
@@ -16,6 +16,12 @@ mysql2spatial:
16
16
  mysql2_makara:
17
17
  <<: *mysql2
18
18
 
19
+ mysql2_proxy:
20
+ <<: *mysql2
21
+
22
+ janus_mysql2:
23
+ <<: *mysql2
24
+
19
25
  postgresql: &postgresql
20
26
  <<: *common
21
27
  username: postgres
@@ -26,6 +32,9 @@ postgresql: &postgresql
26
32
  postresql_makara:
27
33
  <<: *postgresql
28
34
 
35
+ postresql_proxy:
36
+ <<: *postgresql
37
+
29
38
  postgis:
30
39
  <<: *postgresql
31
40
 
@@ -57,3 +66,8 @@ trilogy:
57
66
  <<: *common
58
67
  adapter: trilogy
59
68
  host: mysql
69
+
70
+ janus_trilogy:
71
+ <<: *common
72
+ adapter: trilogy
73
+ host: mysql
@@ -30,6 +30,12 @@ mysql2spatial:
30
30
  mysql2_makara:
31
31
  <<: *mysql2
32
32
 
33
+ mysql2_proxy:
34
+ <<: *mysql2
35
+
36
+ janus_mysql2:
37
+ <<: *mysql2
38
+
33
39
  oracle:
34
40
  <<: *common
35
41
  adapter: oracle
@@ -45,6 +51,9 @@ postgresql: &postgresql
45
51
  postresql_makara:
46
52
  <<: *postgresql
47
53
 
54
+ postresql_proxy:
55
+ <<: *postgresql
56
+
48
57
  postgis:
49
58
  <<: *postgresql
50
59
 
@@ -70,3 +79,7 @@ spatialite:
70
79
  trilogy:
71
80
  <<: *common
72
81
  adapter: trilogy
82
+
83
+ janus_trilogy:
84
+ <<: *common
85
+ adapter: trilogy
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
4
+
5
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/assertions")
6
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/mysql/import_examples")
7
+
8
+ should_support_mysql_import_functionality
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
4
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/assertions")
5
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/mysql/import_examples")
6
+
7
+ should_support_mysql_import_functionality
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
4
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/mysql/import_examples")
5
+
6
+ should_support_mysql_import_functionality
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
4
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/postgresql/import_examples")
5
+
6
+ should_support_postgresql_import_functionality
data/test/test_helper.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'pathname'
4
4
  require 'rake'
5
+ require 'logger'
6
+
5
7
  test_dir = Pathname.new File.dirname(__FILE__)
6
8
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
9
  $LOAD_PATH.unshift(File.dirname(__FILE__))
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: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-10 00:00:00.000000000 Z
11
+ date: 2025-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -99,16 +99,20 @@ files:
99
99
  - lib/activerecord-import/synchronize.rb
100
100
  - lib/activerecord-import/value_sets_parser.rb
101
101
  - lib/activerecord-import/version.rb
102
+ - test/adapters/janus_mysql2.rb
103
+ - test/adapters/janus_trilogy.rb
102
104
  - test/adapters/jdbcmysql.rb
103
105
  - test/adapters/jdbcpostgresql.rb
104
106
  - test/adapters/jdbcsqlite3.rb
105
107
  - test/adapters/makara_postgis.rb
106
108
  - test/adapters/mysql2.rb
107
109
  - test/adapters/mysql2_makara.rb
110
+ - test/adapters/mysql2_proxy.rb
108
111
  - test/adapters/mysql2spatial.rb
109
112
  - test/adapters/postgis.rb
110
113
  - test/adapters/postgresql.rb
111
114
  - test/adapters/postgresql_makara.rb
115
+ - test/adapters/postgresql_proxy.rb
112
116
  - test/adapters/seamless_database_pool.rb
113
117
  - test/adapters/spatialite.rb
114
118
  - test/adapters/sqlite3.rb
@@ -116,6 +120,8 @@ files:
116
120
  - test/database.yml.sample
117
121
  - test/github/database.yml
118
122
  - test/import_test.rb
123
+ - test/janus_mysql2/import_test.rb
124
+ - test/janus_trilogy/import_test.rb
119
125
  - test/jdbcmysql/import_test.rb
120
126
  - test/jdbcpostgresql/import_test.rb
121
127
  - test/jdbcsqlite3/import_test.rb
@@ -151,9 +157,11 @@ files:
151
157
  - test/models/widget.rb
152
158
  - test/mysql2/import_test.rb
153
159
  - test/mysql2_makara/import_test.rb
160
+ - test/mysql2_proxy/import_test.rb
154
161
  - test/mysqlspatial2/import_test.rb
155
162
  - test/postgis/import_test.rb
156
163
  - test/postgresql/import_test.rb
164
+ - test/postgresql_proxy/import_test.rb
157
165
  - test/schema/generic_schema.rb
158
166
  - test/schema/jdbcpostgresql_schema.rb
159
167
  - test/schema/mysql2_schema.rb
@@ -202,16 +210,20 @@ signing_key:
202
210
  specification_version: 4
203
211
  summary: Bulk insert extension for ActiveRecord
204
212
  test_files:
213
+ - test/adapters/janus_mysql2.rb
214
+ - test/adapters/janus_trilogy.rb
205
215
  - test/adapters/jdbcmysql.rb
206
216
  - test/adapters/jdbcpostgresql.rb
207
217
  - test/adapters/jdbcsqlite3.rb
208
218
  - test/adapters/makara_postgis.rb
209
219
  - test/adapters/mysql2.rb
210
220
  - test/adapters/mysql2_makara.rb
221
+ - test/adapters/mysql2_proxy.rb
211
222
  - test/adapters/mysql2spatial.rb
212
223
  - test/adapters/postgis.rb
213
224
  - test/adapters/postgresql.rb
214
225
  - test/adapters/postgresql_makara.rb
226
+ - test/adapters/postgresql_proxy.rb
215
227
  - test/adapters/seamless_database_pool.rb
216
228
  - test/adapters/spatialite.rb
217
229
  - test/adapters/sqlite3.rb
@@ -219,6 +231,8 @@ test_files:
219
231
  - test/database.yml.sample
220
232
  - test/github/database.yml
221
233
  - test/import_test.rb
234
+ - test/janus_mysql2/import_test.rb
235
+ - test/janus_trilogy/import_test.rb
222
236
  - test/jdbcmysql/import_test.rb
223
237
  - test/jdbcpostgresql/import_test.rb
224
238
  - test/jdbcsqlite3/import_test.rb
@@ -254,9 +268,11 @@ test_files:
254
268
  - test/models/widget.rb
255
269
  - test/mysql2/import_test.rb
256
270
  - test/mysql2_makara/import_test.rb
271
+ - test/mysql2_proxy/import_test.rb
257
272
  - test/mysqlspatial2/import_test.rb
258
273
  - test/postgis/import_test.rb
259
274
  - test/postgresql/import_test.rb
275
+ - test/postgresql_proxy/import_test.rb
260
276
  - test/schema/generic_schema.rb
261
277
  - test/schema/jdbcpostgresql_schema.rb
262
278
  - test/schema/mysql2_schema.rb